-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
115 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
111 changes: 111 additions & 0 deletions
111
apps/docs/prisma/migrations/20240625141815_init/migration.sql
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,111 @@ | ||
-- CreateTable | ||
CREATE TABLE "Comment" ( | ||
"id" SERIAL NOT NULL, | ||
"page" VARCHAR(256), | ||
"thread" INTEGER, | ||
"author" VARCHAR(256) NOT NULL, | ||
"content" JSON NOT NULL, | ||
"timestamp" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "Comment_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Rate" ( | ||
"userId" VARCHAR(256) NOT NULL, | ||
"commentId" INTEGER NOT NULL, | ||
"like" BOOLEAN NOT NULL, | ||
|
||
CONSTRAINT "Rate_pkey" PRIMARY KEY ("userId","commentId") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT, | ||
"email" TEXT NOT NULL, | ||
"emailVerified" TIMESTAMP(3), | ||
"image" TEXT, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Account" ( | ||
"userId" TEXT NOT NULL, | ||
"type" TEXT NOT NULL, | ||
"provider" TEXT NOT NULL, | ||
"providerAccountId" TEXT NOT NULL, | ||
"refresh_token" TEXT, | ||
"access_token" TEXT, | ||
"expires_at" INTEGER, | ||
"token_type" TEXT, | ||
"scope" TEXT, | ||
"id_token" TEXT, | ||
"session_state" TEXT, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Account_pkey" PRIMARY KEY ("provider","providerAccountId") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Session" ( | ||
"sessionToken" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"expires" TIMESTAMP(3) NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "VerificationToken" ( | ||
"identifier" TEXT NOT NULL, | ||
"token" TEXT NOT NULL, | ||
"expires" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "VerificationToken_pkey" PRIMARY KEY ("identifier","token") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Authenticator" ( | ||
"credentialID" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"providerAccountId" TEXT NOT NULL, | ||
"credentialPublicKey" TEXT NOT NULL, | ||
"counter" INTEGER NOT NULL, | ||
"credentialDeviceType" TEXT NOT NULL, | ||
"credentialBackedUp" BOOLEAN NOT NULL, | ||
"transports" TEXT, | ||
|
||
CONSTRAINT "Authenticator_pkey" PRIMARY KEY ("userId","credentialID") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Comment_page_idx" ON "Comment"("page"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Rate_commentId_idx" ON "Rate"("commentId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Authenticator_credentialID_key" ON "Authenticator"("credentialID"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Rate" ADD CONSTRAINT "Rate_commentId_fkey" FOREIGN KEY ("commentId") REFERENCES "Comment"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Authenticator" ADD CONSTRAINT "Authenticator_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |