From 060ac00fc738245b4df0da026c075c1ab638954a Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Sat, 1 Oct 2022 08:45:16 +1000 Subject: [PATCH] Take out _stash_ids from 35 migration --- pkg/sqlite/migrations/35_assoc_tables.up.sql | 74 -------------------- 1 file changed, 74 deletions(-) diff --git a/pkg/sqlite/migrations/35_assoc_tables.up.sql b/pkg/sqlite/migrations/35_assoc_tables.up.sql index 8c476feda..8bbb40d19 100644 --- a/pkg/sqlite/migrations/35_assoc_tables.up.sql +++ b/pkg/sqlite/migrations/35_assoc_tables.up.sql @@ -315,80 +315,6 @@ ALTER TABLE `scene_stash_ids_new` rename to `scene_stash_ids`; -- CREATE INDEX `index_scene_stash_ids_on_scene_id` ON `scene_stash_ids` (`scene_id`); --- delete identical rows from performer_stash_ids before performing this --- translation -DELETE FROM `performer_stash_ids` WHERE - rowid > ( - SELECT MIN(rowid) FROM `performer_stash_ids` d - WHERE `performer_stash_ids`.`performer_id` = d.`performer_id` AND - `performer_stash_ids`.`endpoint` = d.`endpoint` AND - `performer_stash_ids`.`stash_id` = d.`stash_id` -); - -CREATE TABLE `performer_stash_ids_new` ( - `performer_id` integer NOT NULL, - `endpoint` varchar(255) NOT NULL, - `stash_id` varchar(36) NOT NULL, - foreign key(`performer_id`) references `performers`(`id`) on delete CASCADE, - PRIMARY KEY(`performer_id`, `endpoint`) -); - -INSERT INTO `performer_stash_ids_new` - ( - `performer_id`, - `endpoint`, - `stash_id` - ) - SELECT - `performer_id`, - `endpoint`, - `stash_id` - FROM `performer_stash_ids`; - -DROP TABLE `performer_stash_ids`; -ALTER TABLE `performer_stash_ids_new` rename to `performer_stash_ids`; - --- the following index is removed in favour of primary key --- CREATE INDEX `index_performer_stash_ids_on_performer_id` ON `performer_stash_ids` (`performer_id`); - - --- delete identical rows from studio_stash_ids before performing this --- translation -DELETE FROM `studio_stash_ids` WHERE - rowid > ( - SELECT MIN(rowid) FROM `studio_stash_ids` d - WHERE `studio_stash_ids`.`studio_id` = d.`studio_id` AND - `studio_stash_ids`.`endpoint` = d.`endpoint` AND - `studio_stash_ids`.`stash_id` = d.`stash_id` -); - -CREATE TABLE `studio_stash_ids_new` ( - `studio_id` integer NOT NULL, - `endpoint` varchar(255) NOT NULL, - `stash_id` varchar(36) NOT NULL, - foreign key(`studio_id`) references `studios`(`id`) on delete CASCADE, - PRIMARY KEY(`studio_id`, `endpoint`) -); - -INSERT INTO `studio_stash_ids_new` - ( - `studio_id`, - `endpoint`, - `stash_id` - ) - SELECT - `studio_id`, - `endpoint`, - `stash_id` - FROM `studio_stash_ids`; - -DROP TABLE `studio_stash_ids`; -ALTER TABLE `studio_stash_ids_new` rename to `studio_stash_ids`; - --- the following index is removed in favour of primary key --- CREATE INDEX `index_studio_stash_ids_on_studio_id` ON `studio_stash_ids` (`studio_id`); - - CREATE TABLE `scenes_galleries_new` ( `scene_id` integer NOT NULL, `gallery_id` integer NOT NULL,