-
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.
Start user authentication implementation
- Loading branch information
Showing
37 changed files
with
2,254 additions
and
104 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,147 @@ | ||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" SERIAL NOT NULL, | ||
"username" TEXT NOT NULL, | ||
"firstName" TEXT NOT NULL, | ||
"lastName" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"password" TEXT NOT NULL, | ||
"avatar" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "FriendRequest" ( | ||
"id" SERIAL NOT NULL, | ||
"senderId" INTEGER NOT NULL, | ||
"reveiverId" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "FriendRequest_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "UserProfile" ( | ||
"id" SERIAL NOT NULL, | ||
"bio" TEXT, | ||
"userId" INTEGER NOT NULL, | ||
|
||
CONSTRAINT "UserProfile_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Dream" ( | ||
"id" SERIAL NOT NULL, | ||
"title" VARCHAR(500) NOT NULL, | ||
"description" VARCHAR(5000) NOT NULL, | ||
"comments" VARCHAR(1000), | ||
"userId" INTEGER NOT NULL, | ||
|
||
CONSTRAINT "Dream_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "DreamTag" ( | ||
"id" SERIAL NOT NULL, | ||
"tag" VARCHAR(64) NOT NULL, | ||
"userId" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "DreamTag_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "DreamCharacter" ( | ||
"id" SERIAL NOT NULL, | ||
"name" VARCHAR(256) NOT NULL, | ||
"userId" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "DreamCharacter_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_UserFriends" ( | ||
"A" INTEGER NOT NULL, | ||
"B" INTEGER NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_DreamToDreamTag" ( | ||
"A" INTEGER NOT NULL, | ||
"B" INTEGER NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_DreamToDreamCharacter" ( | ||
"A" INTEGER NOT NULL, | ||
"B" INTEGER NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "UserProfile_userId_key" ON "UserProfile"("userId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_UserFriends_AB_unique" ON "_UserFriends"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_UserFriends_B_index" ON "_UserFriends"("B"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_DreamToDreamTag_AB_unique" ON "_DreamToDreamTag"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_DreamToDreamTag_B_index" ON "_DreamToDreamTag"("B"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_DreamToDreamCharacter_AB_unique" ON "_DreamToDreamCharacter"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_DreamToDreamCharacter_B_index" ON "_DreamToDreamCharacter"("B"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "FriendRequest" ADD CONSTRAINT "FriendRequest_senderId_fkey" FOREIGN KEY ("senderId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "FriendRequest" ADD CONSTRAINT "FriendRequest_reveiverId_fkey" FOREIGN KEY ("reveiverId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "UserProfile" ADD CONSTRAINT "UserProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Dream" ADD CONSTRAINT "Dream_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "DreamTag" ADD CONSTRAINT "DreamTag_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "DreamCharacter" ADD CONSTRAINT "DreamCharacter_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_UserFriends" ADD CONSTRAINT "_UserFriends_A_fkey" FOREIGN KEY ("A") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_UserFriends" ADD CONSTRAINT "_UserFriends_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_DreamToDreamTag" ADD CONSTRAINT "_DreamToDreamTag_A_fkey" FOREIGN KEY ("A") REFERENCES "Dream"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_DreamToDreamTag" ADD CONSTRAINT "_DreamToDreamTag_B_fkey" FOREIGN KEY ("B") REFERENCES "DreamTag"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_DreamToDreamCharacter" ADD CONSTRAINT "_DreamToDreamCharacter_A_fkey" FOREIGN KEY ("A") REFERENCES "Dream"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_DreamToDreamCharacter" ADD CONSTRAINT "_DreamToDreamCharacter_B_fkey" FOREIGN KEY ("B") REFERENCES "DreamCharacter"("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,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ALTER COLUMN "avatar" DROP NOT NULL; |
2 changes: 2 additions & 0 deletions
2
prisma/migrations/20231024172638_password_update/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,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ALTER COLUMN "password" DROP NOT NULL; |
5 changes: 5 additions & 0 deletions
5
prisma/migrations/20231024174619_account_provider_update/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,5 @@ | ||
-- CreateEnum | ||
CREATE TYPE "AccountProvider" AS ENUM ('GOOGLE'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "accountProivder" "AccountProvider"; |
9 changes: 9 additions & 0 deletions
9
prisma/migrations/20231024174647_account_provider_update/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,9 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `accountProivder` on the `User` table. All the data in the column will be lost. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "User" DROP COLUMN "accountProivder", | ||
ADD COLUMN "accountProvider" "AccountProvider"; |
Oops, something went wrong.