62 lines
1.6 KiB
Markdown
62 lines
1.6 KiB
Markdown
# Migration `20201019072122-add-simplify-user-model`
|
|
|
|
This migration has been generated by Kurt Hutten at 10/19/2020, 6:21:22 PM.
|
|
You can check out the [state of the schema](./schema.prisma) after the migration.
|
|
|
|
## Database Steps
|
|
|
|
```sql
|
|
DROP INDEX "User.issuer_unique"
|
|
|
|
DROP INDEX "User.userName_unique"
|
|
|
|
PRAGMA foreign_keys=OFF;
|
|
CREATE TABLE "new_User" (
|
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
"email" TEXT NOT NULL,
|
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" DATETIME NOT NULL,
|
|
"image" TEXT,
|
|
"bio" TEXT
|
|
);
|
|
INSERT INTO "new_User" ("id", "email", "createdAt", "updatedAt", "image", "bio") SELECT "id", "email", "createdAt", "updatedAt", "image", "bio" FROM "User";
|
|
DROP TABLE "User";
|
|
ALTER TABLE "new_User" RENAME TO "User";
|
|
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");
|
|
PRAGMA foreign_key_check;
|
|
PRAGMA foreign_keys=ON
|
|
```
|
|
|
|
## Changes
|
|
|
|
```diff
|
|
diff --git schema.prisma schema.prisma
|
|
migration 20201018233330-add-simple-user-model..20201019072122-add-simplify-user-model
|
|
--- datamodel.dml
|
|
+++ datamodel.dml
|
|
@@ -1,7 +1,7 @@
|
|
datasource DS {
|
|
provider = ["sqlite", "postgresql"]
|
|
- url = "***"
|
|
+ url = "***"
|
|
}
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
@@ -34,12 +34,12 @@
|
|
createdAt DateTime @default(now())
|
|
}
|
|
model User {
|
|
- id Int @id @default(autoincrement())
|
|
- userName String @unique
|
|
- email String @unique
|
|
- issuer String @unique
|
|
+ id Int @id @default(autoincrement())
|
|
+ email String @unique
|
|
+ // userName String @unique
|
|
+ // issuer String @unique
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
```
|
|
|
|
|