From 4d004d55b59a4c45a255e3c160bf360e77c05eb5 Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Mon, 11 Apr 2022 13:34:30 +0200 Subject: [PATCH] Add wishlists_saved table --- src/pages/install.php | 14 ++++++++++++++ src/update/0-6-0.sql | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/update/0-6-0.sql diff --git a/src/pages/install.php b/src/pages/install.php index 857b2a27..54815632 100644 --- a/src/pages/install.php +++ b/src/pages/install.php @@ -156,6 +156,20 @@ switch ($step) { );'); $database->query('CREATE INDEX `idx_hash` ON `wishlists` (`hash`);'); + /** + * Wishlists Saved + */ + $database->query('DROP TABLE IF EXISTS `wishlists_saved`;'); + $database->query('CREATE TABLE `wishlists_saved` ( + `id` INT PRIMARY KEY AUTO_INCREMENT, + `user` INT NOT NULL, + `wishlist` INT NOT NULL, + FOREIGN KEY (`user`) + REFERENCES `users` (`id`) + ON DELETE CASCADE + );'); + $database->query('CREATE INDEX `idx_wishlist` ON `wishlists_saved` (`wishlist`);'); + /** * Wishes */ diff --git a/src/update/0-6-0.sql b/src/update/0-6-0.sql new file mode 100644 index 00000000..b4fbc287 --- /dev/null +++ b/src/update/0-6-0.sql @@ -0,0 +1,10 @@ +CREATE TABLE `wishlists_saved` ( + `id` INT PRIMARY KEY AUTO_INCREMENT, + `user` INT NOT NULL, + `wishlist` INT NOT NULL, + FOREIGN KEY (`user`) + REFERENCES `users` (`id`) + ON DELETE CASCADE +); + +CREATE INDEX `idx_wishlist` ON `wishlists_saved` (`wishlist`);