-
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.
feat(api): add ListMovie bridging table
- Loading branch information
1 parent
915ec4b
commit 0a95e2b
Showing
6 changed files
with
98 additions
and
36 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
api/prisma/migrations/20240614155136_add_list_movie_table/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 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the `_ListToMovie` table. If the table is not empty, all the data it contains will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "_ListToMovie" DROP CONSTRAINT "_ListToMovie_A_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "_ListToMovie" DROP CONSTRAINT "_ListToMovie_B_fkey"; | ||
|
||
-- DropTable | ||
DROP TABLE "_ListToMovie"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "ListMovie" ( | ||
"list_id" UUID NOT NULL, | ||
"movie_id" UUID NOT NULL, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "ListMovie_pkey" PRIMARY KEY ("list_id","movie_id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "ListMovie" ADD CONSTRAINT "ListMovie_list_id_fkey" FOREIGN KEY ("list_id") REFERENCES "List"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "ListMovie" ADD CONSTRAINT "ListMovie_movie_id_fkey" FOREIGN KEY ("movie_id") REFERENCES "Movie"("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
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
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