This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
-
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.
- Loading branch information
ludovicGendre
committed
Jan 27, 2022
1 parent
3a51f10
commit a493b5e
Showing
7 changed files
with
131 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,4 @@ lerna-debug.log* | |
**/docker/volumes | ||
|
||
# Prisma | ||
**/prisma/migrations | ||
# **/prisma/migrations |
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ export const seedAccounts = async (): Promise<void> => { | |
username: 'Test', | ||
birthDate: Faker.date.between('1985-01-01', '2000-01-05'), | ||
email: '[email protected]', | ||
isEmailConfirmed: true, | ||
city: { connect: random.arrayElement(cities.map((m) => ({ id: m.id }))) }, | ||
sex: 1, | ||
latitude: 44.837789 + generateRandomFloatInRange(-0.5, 0.5), | ||
|
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,103 @@ | ||
-- CreateTable | ||
CREATE TABLE "Account" ( | ||
"id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
"password" TEXT NOT NULL, | ||
"username" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Account_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "City" ( | ||
"name" TEXT NOT NULL, | ||
"postalCode" TEXT NOT NULL, | ||
"id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
|
||
CONSTRAINT "City_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
"firstName" TEXT NOT NULL, | ||
"lastName" TEXT NOT NULL, | ||
"username" TEXT NOT NULL, | ||
"birthDate" TIMESTAMPTZ(6), | ||
"email" TEXT NOT NULL, | ||
"sex" INTEGER NOT NULL DEFAULT 0, | ||
"latitude" DOUBLE PRECISION, | ||
"isEmailConfirmed" BOOLEAN NOT NULL DEFAULT false, | ||
"longitude" DOUBLE PRECISION, | ||
"avatarId" UUID, | ||
"cityId" UUID NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Breed" ( | ||
"name" TEXT NOT NULL, | ||
"id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
|
||
CONSTRAINT "Breed_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Animal" ( | ||
"name" TEXT, | ||
"sex" INTEGER NOT NULL DEFAULT 0, | ||
"height" INTEGER NOT NULL, | ||
"weight" INTEGER, | ||
"description" TEXT NOT NULL, | ||
"castrated" BOOLEAN NOT NULL, | ||
"birthYear" INTEGER NOT NULL, | ||
"id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
"userId" UUID NOT NULL, | ||
|
||
CONSTRAINT "Animal_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "File" ( | ||
"id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
"fileName" TEXT NOT NULL, | ||
"data" BYTEA NOT NULL, | ||
|
||
CONSTRAINT "File_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_AnimalToBreed" ( | ||
"A" UUID NOT NULL, | ||
"B" UUID NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Account_username_key" ON "Account"("username"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_AnimalToBreed_AB_unique" ON "_AnimalToBreed"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_AnimalToBreed_B_index" ON "_AnimalToBreed"("B"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "User" ADD CONSTRAINT "User_avatarId_fkey" FOREIGN KEY ("avatarId") REFERENCES "File"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "User" ADD CONSTRAINT "User_cityId_fkey" FOREIGN KEY ("cityId") REFERENCES "City"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Animal" ADD CONSTRAINT "Animal_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_AnimalToBreed" ADD FOREIGN KEY ("A") REFERENCES "Animal"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_AnimalToBreed" ADD FOREIGN KEY ("B") REFERENCES "Breed"("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" |
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
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