# Migration `20201213004819-add-delete-on-part` This migration has been generated by Kurt Hutten at 12/13/2020, 11:48:20 AM. You can check out the [state of the schema](./schema.prisma) after the migration. ## Database Steps ```sql PRAGMA foreign_keys=OFF; CREATE TABLE "new_Part" ( "id" TEXT NOT NULL, "title" TEXT NOT NULL, "description" TEXT, "code" TEXT, "mainImage" TEXT, "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" DATETIME NOT NULL, "userId" TEXT NOT NULL, "deleted" BOOLEAN NOT NULL DEFAULT false, FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("id") ); INSERT INTO "new_Part" ("id", "title", "description", "code", "mainImage", "createdAt", "updatedAt", "userId") SELECT "id", "title", "description", "code", "mainImage", "createdAt", "updatedAt", "userId" FROM "Part"; DROP TABLE "Part"; ALTER TABLE "new_Part" RENAME TO "Part"; CREATE UNIQUE INDEX "Part.title_userId_unique" ON "Part"("title", "userId"); PRAGMA foreign_key_check; PRAGMA foreign_keys=ON ``` ## Changes ```diff diff --git schema.prisma schema.prisma migration 20201105184423-add-name-to-user..20201213004819-add-delete-on-part --- datamodel.dml +++ datamodel.dml @@ -1,12 +1,12 @@ datasource DS { provider = ["sqlite", "postgresql"] - url = "***" + url = "***" } generator client { provider = "prisma-client-js" - binaryTargets = "native" + binaryTargets = ["native", "rhel-openssl-1.0.x"] } // sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode // enum Role { @@ -47,8 +47,9 @@ createdAt DateTime @default(now()) updatedAt DateTime @updatedAt user User @relation(fields: [userId], references: [id]) userId String + deleted Boolean @default(false) Comment Comment[] Reaction PartReaction[] @@unique([title, userId]) ```