|
| 1 | +-- CreateTable |
| 2 | +CREATE TABLE "Account" ( |
| 3 | + "id" TEXT NOT NULL, |
| 4 | + "userId" TEXT NOT NULL, |
| 5 | + "type" TEXT NOT NULL, |
| 6 | + "provider" TEXT NOT NULL, |
| 7 | + "providerAccountId" TEXT NOT NULL, |
| 8 | + "refresh_token" TEXT, |
| 9 | + "access_token" TEXT, |
| 10 | + "expires_at" INTEGER, |
| 11 | + "token_type" TEXT, |
| 12 | + "scope" TEXT, |
| 13 | + "id_token" TEXT, |
| 14 | + "session_state" TEXT, |
| 15 | + |
| 16 | + CONSTRAINT "Account_pkey" PRIMARY KEY ("id") |
| 17 | +); |
| 18 | + |
| 19 | +-- CreateTable |
| 20 | +CREATE TABLE "Session" ( |
| 21 | + "id" TEXT NOT NULL, |
| 22 | + "sessionToken" TEXT NOT NULL, |
| 23 | + "userId" TEXT NOT NULL, |
| 24 | + "expires" TIMESTAMP(3) NOT NULL, |
| 25 | + |
| 26 | + CONSTRAINT "Session_pkey" PRIMARY KEY ("id") |
| 27 | +); |
| 28 | + |
| 29 | +-- CreateTable |
| 30 | +CREATE TABLE "User" ( |
| 31 | + "id" TEXT NOT NULL, |
| 32 | + "name" TEXT, |
| 33 | + "email" TEXT, |
| 34 | + "emailVerified" TIMESTAMP(3), |
| 35 | + "image" TEXT, |
| 36 | + "admin" BOOLEAN NOT NULL DEFAULT false, |
| 37 | + |
| 38 | + CONSTRAINT "User_pkey" PRIMARY KEY ("id") |
| 39 | +); |
| 40 | + |
| 41 | +-- CreateTable |
| 42 | +CREATE TABLE "VerificationToken" ( |
| 43 | + "identifier" TEXT NOT NULL, |
| 44 | + "token" TEXT NOT NULL, |
| 45 | + "expires" TIMESTAMP(3) NOT NULL |
| 46 | +); |
| 47 | + |
| 48 | +-- CreateTable |
| 49 | +CREATE TABLE "Changelog" ( |
| 50 | + "id" TEXT NOT NULL, |
| 51 | + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 52 | + "publishedAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, |
| 53 | + "updatedAt" TIMESTAMP(3) NOT NULL, |
| 54 | + "title" VARCHAR(255) NOT NULL, |
| 55 | + "slug" VARCHAR(255) NOT NULL, |
| 56 | + "image" TEXT, |
| 57 | + "content" TEXT, |
| 58 | + "summary" TEXT, |
| 59 | + "published" BOOLEAN NOT NULL DEFAULT false, |
| 60 | + "deleted" BOOLEAN NOT NULL DEFAULT false, |
| 61 | + "authorId" TEXT, |
| 62 | + |
| 63 | + CONSTRAINT "Changelog_pkey" PRIMARY KEY ("id") |
| 64 | +); |
| 65 | + |
| 66 | +-- CreateTable |
| 67 | +CREATE TABLE "Category" ( |
| 68 | + "id" TEXT NOT NULL, |
| 69 | + "name" VARCHAR(255) NOT NULL, |
| 70 | + "deleted" BOOLEAN NOT NULL DEFAULT false, |
| 71 | + |
| 72 | + CONSTRAINT "Category_pkey" PRIMARY KEY ("id") |
| 73 | +); |
| 74 | + |
| 75 | +-- CreateTable |
| 76 | +CREATE TABLE "_CategoryToChangelog" ( |
| 77 | + "A" TEXT NOT NULL, |
| 78 | + "B" TEXT NOT NULL |
| 79 | +); |
| 80 | + |
| 81 | +-- CreateIndex |
| 82 | +CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); |
| 83 | + |
| 84 | +-- CreateIndex |
| 85 | +CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); |
| 86 | + |
| 87 | +-- CreateIndex |
| 88 | +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); |
| 89 | + |
| 90 | +-- CreateIndex |
| 91 | +CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"); |
| 92 | + |
| 93 | +-- CreateIndex |
| 94 | +CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token"); |
| 95 | + |
| 96 | +-- CreateIndex |
| 97 | +CREATE UNIQUE INDEX "Changelog_slug_key" ON "Changelog"("slug"); |
| 98 | + |
| 99 | +-- CreateIndex |
| 100 | +CREATE UNIQUE INDEX "Category_name_key" ON "Category"("name"); |
| 101 | + |
| 102 | +-- CreateIndex |
| 103 | +CREATE UNIQUE INDEX "_CategoryToChangelog_AB_unique" ON "_CategoryToChangelog"("A", "B"); |
| 104 | + |
| 105 | +-- CreateIndex |
| 106 | +CREATE INDEX "_CategoryToChangelog_B_index" ON "_CategoryToChangelog"("B"); |
| 107 | + |
| 108 | +-- AddForeignKey |
| 109 | +ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
| 110 | + |
| 111 | +-- AddForeignKey |
| 112 | +ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
| 113 | + |
| 114 | +-- AddForeignKey |
| 115 | +ALTER TABLE "Changelog" ADD CONSTRAINT "Changelog_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
| 116 | + |
| 117 | +-- AddForeignKey |
| 118 | +ALTER TABLE "_CategoryToChangelog" ADD CONSTRAINT "_CategoryToChangelog_A_fkey" FOREIGN KEY ("A") REFERENCES "Category"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
| 119 | + |
| 120 | +-- AddForeignKey |
| 121 | +ALTER TABLE "_CategoryToChangelog" ADD CONSTRAINT "_CategoryToChangelog_B_fkey" FOREIGN KEY ("B") REFERENCES "Changelog"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
0 commit comments