-
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.
Soft delete groups, wishlists and items
- Loading branch information
1 parent
4b24fe7
commit c8618e8
Showing
18 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
prisma/migrations/20231206165259_soft_delete/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,42 @@ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_Group" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"title" TEXT NOT NULL, | ||
"createdAt" DATETIME NOT NULL, | ||
"theme" TEXT, | ||
"removed" BOOLEAN NOT NULL DEFAULT false, | ||
"userId" TEXT NOT NULL, | ||
CONSTRAINT "Group_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_Group" ("createdAt", "id", "theme", "title", "userId") SELECT "createdAt", "id", "theme", "title", "userId" FROM "Group"; | ||
DROP TABLE "Group"; | ||
ALTER TABLE "new_Group" RENAME TO "Group"; | ||
CREATE TABLE "new_WishlistItem" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"title" TEXT NOT NULL, | ||
"url" TEXT, | ||
"createdAt" DATETIME NOT NULL, | ||
"removed" BOOLEAN NOT NULL DEFAULT false, | ||
"userId" TEXT, | ||
"wishlistId" TEXT NOT NULL, | ||
CONSTRAINT "WishlistItem_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE, | ||
CONSTRAINT "WishlistItem_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_WishlistItem" ("createdAt", "id", "title", "url", "userId", "wishlistId") SELECT "createdAt", "id", "title", "url", "userId", "wishlistId" FROM "WishlistItem"; | ||
DROP TABLE "WishlistItem"; | ||
ALTER TABLE "new_WishlistItem" RENAME TO "WishlistItem"; | ||
CREATE TABLE "new_Wishlist" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"title" TEXT, | ||
"createdAt" DATETIME NOT NULL, | ||
"theme" TEXT, | ||
"removed" BOOLEAN NOT NULL DEFAULT false, | ||
"userId" TEXT NOT NULL, | ||
CONSTRAINT "Wishlist_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_Wishlist" ("createdAt", "id", "theme", "title", "userId") SELECT "createdAt", "id", "theme", "title", "userId" FROM "Wishlist"; | ||
DROP TABLE "Wishlist"; | ||
ALTER TABLE "new_Wishlist" RENAME TO "Wishlist"; | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; |
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
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
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 |
---|---|---|
|
@@ -30,6 +30,7 @@ export const updateWishlistItemById = async ( | |
wishlist: { | ||
userId, | ||
}, | ||
removed: false, | ||
}, | ||
}) | ||
|
||
|
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