-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(db): database schema updates (#129)
- Loading branch information
1 parent
784050d
commit bc8337b
Showing
5 changed files
with
80 additions
and
21 deletions.
There are no files selected for viewing
10 changes: 0 additions & 10 deletions
10
app/web/db/migrations/20231030110408_v0_1_0_dev/migration.sql
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
app/web/db/migrations/20231124063103_v0_1_0_dev/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,45 @@ | ||
-- CreateEnum | ||
CREATE TYPE "Role" AS ENUM ('CLIENT', 'PROFESSIONAL'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" SERIAL NOT NULL, | ||
"username" TEXT NOT NULL, | ||
"password" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"firstname" TEXT NOT NULL, | ||
"lastname" TEXT NOT NULL, | ||
"role" "Role" NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Appointment" ( | ||
"id" SERIAL NOT NULL, | ||
"proId" INTEGER NOT NULL, | ||
"clientId" INTEGER NOT NULL, | ||
|
||
CONSTRAINT "Appointment_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Video" ( | ||
"apptId" INTEGER NOT NULL, | ||
"awsRef" TEXT NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Video_awsRef_key" ON "Video"("awsRef"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Appointment" ADD CONSTRAINT "Appointment_proId_fkey" FOREIGN KEY ("proId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Appointment" ADD CONSTRAINT "Appointment_clientId_fkey" FOREIGN KEY ("clientId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Video" ADD CONSTRAINT "Video_apptId_fkey" FOREIGN KEY ("apptId") REFERENCES "Appointment"("id") ON DELETE RESTRICT 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" | ||
provider = "postgresql" |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
id,email,firstname,lastname,username | ||
1,testuser1@gmail.com,user1,test,testuser1 | ||
2,testuser@gmail.com,user2,test,testuser2 | ||
3,testuser3@gmail.com,user3,test,testuser3 | ||
4,testuser4@gmail.com,user4,test,testuser4 | ||
id,email,firstname,lastname,username,password,role | ||
1,testuser1@gmail.com,user1,test,testuser1,password,CLIENT | ||
2,testuser@gmail.com,user2,test,testuser2,password,CLIENT | ||
3,testuser3@gmail.com,user3,test,testuser3,password,PROFESSIONAL | ||
4,testuser4@gmail.com,user4,test,testuser4,password,PROFESSIONAL |
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