From be4672cf3c978cd6f4991ccbe827d8c38861179f Mon Sep 17 00:00:00 2001 From: Eric Matala de Mazza Date: Sun, 30 Apr 2023 13:42:17 +0200 Subject: [PATCH] feat(db): migrate to planetscale db --- package.json | 8 ++-- .../20230430015513_init/migration.sql | 47 ------------------- prisma/migrations/migration_lock.toml | 3 -- prisma/schema.prisma | 5 +- 4 files changed, 7 insertions(+), 56 deletions(-) delete mode 100644 prisma/migrations/20230430015513_init/migration.sql delete mode 100644 prisma/migrations/migration_lock.toml diff --git a/package.json b/package.json index ee2a0ff..3d3da48 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "putzbot", "version": "1.0.0", - "description": "A telegram bot for cleaning duties", - "main": "build/index.js", + "description": "A telegram bot for automating cleaning duties", + "main": "src/index.ts", "scripts": { - "dev": "ts-node src --watch", + "dev": "ts-node src", "build": "tsc", - "start": "tsc && node build" + "start": "tsc && node build/src" }, "prisma": { "seed": "ts-node prisma/seed.ts" diff --git a/prisma/migrations/20230430015513_init/migration.sql b/prisma/migrations/20230430015513_init/migration.sql deleted file mode 100644 index 959b528..0000000 --- a/prisma/migrations/20230430015513_init/migration.sql +++ /dev/null @@ -1,47 +0,0 @@ --- CreateTable -CREATE TABLE "Roomie" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "name" TEXT NOT NULL, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL, - "done" BOOLEAN NOT NULL DEFAULT false, - "dutyId" INTEGER, - CONSTRAINT "Roomie_dutyId_fkey" FOREIGN KEY ("dutyId") REFERENCES "Duty" ("id") ON DELETE SET NULL ON UPDATE CASCADE -); - --- CreateTable -CREATE TABLE "Duty" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "title" TEXT NOT NULL, - "description" TEXT NOT NULL, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL -); - --- CreateTable -CREATE TABLE "Trash" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "title" TEXT NOT NULL -); - --- CreateTable -CREATE TABLE "TrashCollection" ( - "date" DATETIME NOT NULL PRIMARY KEY -); - --- CreateTable -CREATE TABLE "_TrashToTrashCollection" ( - "A" INTEGER NOT NULL, - "B" DATETIME NOT NULL, - CONSTRAINT "_TrashToTrashCollection_A_fkey" FOREIGN KEY ("A") REFERENCES "Trash" ("id") ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT "_TrashToTrashCollection_B_fkey" FOREIGN KEY ("B") REFERENCES "TrashCollection" ("date") ON DELETE CASCADE ON UPDATE CASCADE -); - --- CreateIndex -CREATE UNIQUE INDEX "Roomie_dutyId_key" ON "Roomie"("dutyId"); - --- CreateIndex -CREATE UNIQUE INDEX "_TrashToTrashCollection_AB_unique" ON "_TrashToTrashCollection"("A", "B"); - --- CreateIndex -CREATE INDEX "_TrashToTrashCollection_B_index" ON "_TrashToTrashCollection"("B"); diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml deleted file mode 100644 index e5e5c47..0000000 --- a/prisma/migrations/migration_lock.toml +++ /dev/null @@ -1,3 +0,0 @@ -# Please do not edit this file manually -# It should be added in your version-control system (i.e. Git) -provider = "sqlite" \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 214dc27..a3b285e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -3,8 +3,9 @@ generator client { } datasource db { - provider = "sqlite" - url = env("DATABASE_URL") + provider = "mysql" + url = env("DATABASE_URL") + relationMode = "prisma" } model Roomie {