-
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.
fix: Increase test coverage and improve setup safety
This change introduces the use of advisory locks on startup to ensure safety if multiple clients are bootstrapping simultaneously. Without the lock you run the risk of concurrent updates to the same tables (mostly when using `GRANT`). Signed-off-by: Lucian Buzzo <lucian.buzzo@gmail.com>
- Loading branch information
1 parent
a589ed7
commit ef7d395
Showing
6 changed files
with
320 additions
and
149 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
prisma/migrations/20230125135410_add_tags_model/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,25 @@ | ||
-- CreateTable | ||
CREATE TABLE "Tag" ( | ||
"id" SERIAL NOT NULL, | ||
"label" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Tag_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_PostToTag" ( | ||
"A" INTEGER NOT NULL, | ||
"B" INTEGER NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_PostToTag_AB_unique" ON "_PostToTag"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_PostToTag_B_index" ON "_PostToTag"("B"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_A_fkey" FOREIGN KEY ("A") REFERENCES "Post"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_B_fkey" FOREIGN KEY ("B") REFERENCES "Tag"("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.