-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add migration for new admin boolean on user model
- Loading branch information
1 parent
b6a1a26
commit 895d3e4
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- CreateTable | ||
CREATE TABLE "Site" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT, | ||
"tagline" TEXT, | ||
"lede" TEXT, | ||
"logo" TEXT, | ||
"logoDescription" TEXT | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Page" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
"title" TEXT NOT NULL, | ||
"slug" TEXT NOT NULL, | ||
"body" TEXT NOT NULL | ||
); | ||
|
||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_User" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"email" TEXT NOT NULL, | ||
"token" TEXT NOT NULL, | ||
"emailVerified" BOOLEAN DEFAULT false, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
"doNotSell" BOOLEAN NOT NULL DEFAULT true, | ||
"visualAvatar" TEXT, | ||
"visualAvatarDescription" TEXT, | ||
"isAdmin" BOOLEAN NOT NULL DEFAULT false | ||
); | ||
INSERT INTO "new_User" ("createdAt", "doNotSell", "email", "emailVerified", "id", "token", "updatedAt", "visualAvatar", "visualAvatarDescription") SELECT "createdAt", "doNotSell", "email", "emailVerified", "id", "token", "updatedAt", "visualAvatar", "visualAvatarDescription" FROM "User"; | ||
DROP TABLE "User"; | ||
ALTER TABLE "new_User" RENAME TO "User"; | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
CREATE UNIQUE INDEX "User_token_key" ON "User"("token"); | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Page_slug_key" ON "Page"("slug"); |