Take out _stash_ids from 35 migration

This commit is contained in:
WithoutPants 2022-10-01 08:45:16 +10:00 committed by GitHub
parent 7b83d81820
commit 060ac00fc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 74 deletions

View File

@ -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,