-
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.
s5-1/feat: move all models to postgre
- Loading branch information
Showing
17 changed files
with
402 additions
and
124 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
backend/prisma/migrations/20240421134316_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,29 @@ | ||
-- CreateTable | ||
CREATE TABLE "Folder" ( | ||
"dr_id" TEXT NOT NULL, | ||
"dr_name" TEXT, | ||
"dr_owner" TEXT NOT NULL, | ||
"dr_path" TEXT[], | ||
"dr_removed" BOOLEAN NOT NULL DEFAULT false, | ||
"dr_parent_dir_id" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Folder_pkey" PRIMARY KEY ("dr_id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "File" ( | ||
"fl_id" TEXT NOT NULL, | ||
"fl_name" TEXT NOT NULL, | ||
"fl_extension" TEXT NOT NULL, | ||
"fl_owner" TEXT NOT NULL, | ||
"fl_removed" BOOLEAN NOT NULL DEFAULT false, | ||
"folderId" TEXT NOT NULL, | ||
|
||
CONSTRAINT "File_pkey" PRIMARY KEY ("fl_id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_dr_parent_dir_id_fkey" FOREIGN KEY ("dr_parent_dir_id") REFERENCES "Folder"("dr_id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "File" ADD CONSTRAINT "File_folderId_fkey" FOREIGN KEY ("folderId") REFERENCES "Folder"("dr_id") ON DELETE RESTRICT ON UPDATE CASCADE; |
38 changes: 38 additions & 0 deletions
38
backend/prisma/migrations/20240421135001_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,38 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `File` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The `fl_id` column on the `File` table would be dropped and recreated. This will lead to data loss if there is data in the column. | ||
- The primary key for the `Folder` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The `dr_id` column on the `Folder` table would be dropped and recreated. This will lead to data loss if there is data in the column. | ||
- Changed the type of `folderId` on the `File` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. | ||
- Changed the type of `dr_parent_dir_id` on the `Folder` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "File" DROP CONSTRAINT "File_folderId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_dr_parent_dir_id_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "File" DROP CONSTRAINT "File_pkey", | ||
DROP COLUMN "fl_id", | ||
ADD COLUMN "fl_id" SERIAL NOT NULL, | ||
DROP COLUMN "folderId", | ||
ADD COLUMN "folderId" INTEGER NOT NULL, | ||
ADD CONSTRAINT "File_pkey" PRIMARY KEY ("fl_id"); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_pkey", | ||
DROP COLUMN "dr_id", | ||
ADD COLUMN "dr_id" SERIAL NOT NULL, | ||
DROP COLUMN "dr_parent_dir_id", | ||
ADD COLUMN "dr_parent_dir_id" INTEGER NOT NULL, | ||
ADD CONSTRAINT "Folder_pkey" PRIMARY KEY ("dr_id"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_dr_parent_dir_id_fkey" FOREIGN KEY ("dr_parent_dir_id") REFERENCES "Folder"("dr_id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "File" ADD CONSTRAINT "File_folderId_fkey" FOREIGN KEY ("folderId") REFERENCES "Folder"("dr_id") ON DELETE RESTRICT ON UPDATE CASCADE; |
41 changes: 41 additions & 0 deletions
41
backend/prisma/migrations/20240421142255_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,41 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `Folder` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- You are about to drop the column `dr_id` on the `Folder` table. All the data in the column will be lost. | ||
- You are about to drop the column `dr_name` on the `Folder` table. All the data in the column will be lost. | ||
- You are about to drop the column `dr_owner` on the `Folder` table. All the data in the column will be lost. | ||
- You are about to drop the column `dr_parent_dir_id` on the `Folder` table. All the data in the column will be lost. | ||
- You are about to drop the column `dr_path` on the `Folder` table. All the data in the column will be lost. | ||
- You are about to drop the column `dr_removed` on the `Folder` table. All the data in the column will be lost. | ||
- Added the required column `fd_owner` to the `Folder` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `fd_parent_folder_id` to the `Folder` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "File" DROP CONSTRAINT "File_folderId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_dr_parent_dir_id_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_pkey", | ||
DROP COLUMN "dr_id", | ||
DROP COLUMN "dr_name", | ||
DROP COLUMN "dr_owner", | ||
DROP COLUMN "dr_parent_dir_id", | ||
DROP COLUMN "dr_path", | ||
DROP COLUMN "dr_removed", | ||
ADD COLUMN "fd_id" SERIAL NOT NULL, | ||
ADD COLUMN "fd_name" TEXT, | ||
ADD COLUMN "fd_owner" TEXT NOT NULL, | ||
ADD COLUMN "fd_parent_folder_id" INTEGER NOT NULL, | ||
ADD COLUMN "fd_path" INTEGER[], | ||
ADD COLUMN "fd_removed" BOOLEAN NOT NULL DEFAULT false, | ||
ADD CONSTRAINT "Folder_pkey" PRIMARY KEY ("fd_id"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_fd_parent_folder_id_fkey" FOREIGN KEY ("fd_parent_folder_id") REFERENCES "Folder"("fd_id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "File" ADD CONSTRAINT "File_folderId_fkey" FOREIGN KEY ("folderId") REFERENCES "Folder"("fd_id") ON DELETE RESTRICT ON UPDATE CASCADE; |
34 changes: 34 additions & 0 deletions
34
backend/prisma/migrations/20240421145436_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,34 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `File` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The primary key for the `Folder` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "File" DROP CONSTRAINT "File_folderId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_fd_parent_folder_id_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "File" DROP CONSTRAINT "File_pkey", | ||
ALTER COLUMN "fl_id" DROP DEFAULT, | ||
ALTER COLUMN "fl_id" SET DATA TYPE TEXT, | ||
ALTER COLUMN "folderId" SET DATA TYPE TEXT, | ||
ADD CONSTRAINT "File_pkey" PRIMARY KEY ("fl_id"); | ||
DROP SEQUENCE "File_fl_id_seq"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_pkey", | ||
ALTER COLUMN "fd_id" DROP DEFAULT, | ||
ALTER COLUMN "fd_id" SET DATA TYPE TEXT, | ||
ALTER COLUMN "fd_parent_folder_id" SET DATA TYPE TEXT, | ||
ADD CONSTRAINT "Folder_pkey" PRIMARY KEY ("fd_id"); | ||
DROP SEQUENCE "Folder_fd_id_seq"; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_fd_parent_folder_id_fkey" FOREIGN KEY ("fd_parent_folder_id") REFERENCES "Folder"("fd_id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "File" ADD CONSTRAINT "File_folderId_fkey" FOREIGN KEY ("folderId") REFERENCES "Folder"("fd_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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "Folder" ALTER COLUMN "fd_path" SET DATA TYPE TEXT[]; |
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,8 @@ | ||
-- DropForeignKey | ||
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_fd_parent_folder_id_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Folder" ALTER COLUMN "fd_parent_folder_id" DROP NOT NULL; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_fd_parent_folder_id_fkey" FOREIGN KEY ("fd_parent_folder_id") REFERENCES "Folder"("fd_id") ON DELETE SET NULL 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,5 @@ | ||
-- DropForeignKey | ||
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_fd_parent_folder_id_fkey"; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_fd_parent_folder_id_fkey" FOREIGN KEY ("fd_parent_folder_id") REFERENCES "Folder"("fd_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
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
Oops, something went wrong.