In progress
This commit is contained in:
parent
8587bed703
commit
38133be15d
21
migrations/20230812111348_orphan_reminders.sql
Normal file
21
migrations/20230812111348_orphan_reminders.sql
Normal file
@ -0,0 +1,21 @@
|
||||
-- Drop existing constraint
|
||||
-- TODO
|
||||
ALTER TABLE `reminders` DROP CONSTRAINT `channel_id_`
|
||||
|
||||
ALTER TABLE `reminders` MODIFY COLUMN `channel_id` BIGINT ;
|
||||
ALTER TABLE `reminders` ADD COLUMN `guild_id` BIGINT;
|
||||
|
||||
ALTER TABLE `reminders`
|
||||
ADD CONSTRAINT `guild_id_fk`
|
||||
FOREIGN KEY (`guild_id`)
|
||||
REFERENCES `guilds`(`id`)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE `reminders`
|
||||
ADD CONSTRAINT `channel_id_fk`
|
||||
FOREIGN KEY (`channel_id`)
|
||||
REFERENCES `channels`(`id`)
|
||||
ON DELETE SET NULL;
|
||||
|
||||
-- TODO
|
||||
UPDATE `reminders` SET `guild_id` = (SELECT guilds.`id` FROM `channels` INNER JOIN `guilds` ON channels.guild_id = guilds.id WHERE )
|
Loading…
Reference in New Issue
Block a user