From 51f4dd8a59e54e17ce603f2772522ad7e5be537f Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Fri, 30 Sep 2022 18:10:55 +1000 Subject: [PATCH] Delete identical studio stash id rows --- pkg/sqlite/migrations/35_assoc_tables.up.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/sqlite/migrations/35_assoc_tables.up.sql b/pkg/sqlite/migrations/35_assoc_tables.up.sql index 4949bcd2c..8c476feda 100644 --- a/pkg/sqlite/migrations/35_assoc_tables.up.sql +++ b/pkg/sqlite/migrations/35_assoc_tables.up.sql @@ -352,6 +352,16 @@ ALTER TABLE `performer_stash_ids_new` rename to `performer_stash_ids`; -- 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,