Restructure guilds table
This commit is contained in:
		@@ -5,8 +5,11 @@ DROP TABLE IF EXISTS embeds;
 | 
			
		||||
DROP TABLE IF EXISTS embed_fields;
 | 
			
		||||
DROP TABLE IF EXISTS command_aliases;
 | 
			
		||||
DROP TABLE IF EXISTS macro;
 | 
			
		||||
DROP TABLE IF EXISTS command_restrictions;
 | 
			
		||||
DROP TABLE IF EXISTS roles;
 | 
			
		||||
 | 
			
		||||
SET FOREIGN_KEY_CHECKS = 0;
 | 
			
		||||
 | 
			
		||||
-- Drop columns from channels that are no longer used
 | 
			
		||||
ALTER TABLE channels DROP COLUMN `name`;
 | 
			
		||||
ALTER TABLE channels DROP COLUMN `blacklisted`;
 | 
			
		||||
@@ -54,7 +57,6 @@ CREATE TABLE `todos_new` (
 | 
			
		||||
INSERT INTO todos_new (id, guild_id, channel_id, user_id, value) SELECT id, (SELECT guild FROM guilds_old WHERE id = guild_id), channel_id, user_id, value FROM todos;
 | 
			
		||||
RENAME TABLE todos TO todos_old;
 | 
			
		||||
RENAME TABLE todos_new TO todos;
 | 
			
		||||
DROP TABLE todos_old;
 | 
			
		||||
 | 
			
		||||
-- Update fk on reminder_template to point at new guild table
 | 
			
		||||
ALTER TABLE reminder_template
 | 
			
		||||
@@ -76,4 +78,7 @@ ALTER TABLE command_macro
 | 
			
		||||
        ON UPDATE CASCADE;
 | 
			
		||||
UPDATE command_macro SET guild_id = (SELECT guild FROM guilds_old WHERE id = guild_id);
 | 
			
		||||
 | 
			
		||||
DROP TABLE todos_old;
 | 
			
		||||
DROP TABLE guilds_old;
 | 
			
		||||
 | 
			
		||||
SET FOREIGN_KEY_CHECKS = 1;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user