Skip to content

Commit

Permalink
add migration for new admin boolean on user model
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsender committed Jun 7, 2024
1 parent b6a1a26 commit 895d3e4
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions prisma/migrations/20240607171950_is_admin/migration.sql
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");

0 comments on commit 895d3e4

Please sign in to comment.