-
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.
Update Schema and Include Seeds (#21)
- Loading branch information
Showing
17 changed files
with
535 additions
and
186 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
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
Binary file removed
BIN
-232 Bytes
...che/babel-loader/bc9d409bd3cae8e2c68925fc4d7d11000b33cc6a86b10c5e609f0981e2b67d1c.json.gz
Binary file not shown.
Binary file removed
BIN
-418 Bytes
...che/babel-loader/fbbbdb9df6f1f26af728f2e5fe39fce44ad3040ac771c0d8ec6eef5d626bf6ea.json.gz
Binary file not shown.
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,3 @@ | ||
# A .env file is needed to run prisma commands at /be/prisma/.env | ||
|
||
DATABASE_URL="postgresql://postgres@localhost:5433/travis_ci_test" |
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
be/prisma/migrations/20230407181400_folder_file_tables/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,35 @@ | ||
-- CreateEnum | ||
CREATE TYPE "Repository" AS ENUM ('VAULT', 'EXHIBIT_SHARE'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Folder" ( | ||
"id" SERIAL NOT NULL, | ||
"parentFolderId" INTEGER, | ||
"repository" "Repository" NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"path" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Folder_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "File" ( | ||
"id" SERIAL NOT NULL, | ||
"folderId" INTEGER NOT NULL, | ||
"repository" "Repository" NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"path" TEXT NOT NULL, | ||
"url" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "File_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_parentFolderId_fkey" FOREIGN KEY ("parentFolderId") REFERENCES "Folder"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "File" ADD CONSTRAINT "File_folderId_fkey" FOREIGN KEY ("folderId") REFERENCES "Folder"("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
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,16 @@ | ||
import prisma from './seeds/prismaClient.js' | ||
import folderSeeder from './seeds/seeders/folderSeeder.js' | ||
import fileSeeder from './seeds/seeders/fileSeeder.js' | ||
|
||
const load = async () => { | ||
try { | ||
await folderSeeder() | ||
await fileSeeder() | ||
} catch (e) { | ||
console.error(e) | ||
process.exit(1) | ||
} finally { | ||
await prisma.$disconnect() | ||
} | ||
} | ||
load() |
Oops, something went wrong.