added to the migration file somewhat. added some checks to components

This commit is contained in:
2021-10-26 22:13:51 +01:00
parent e36e718f28
commit db7cca6296
5 changed files with 129 additions and 68 deletions

View File

@ -9,3 +9,25 @@ CREATE TABLE macro (
FOREIGN KEY (guild_id) REFERENCES guilds(guild) ON DELETE CASCADE,
PRIMARY KEY (id)
);
DROP TABLE IF EXISTS events;
CREATE TABLE reminders.todos_new (
id INT UNSIGNED AUTO_INCREMENT UNIQUE NOT NULL,
user_id BIGINT UNSIGNED,
guild_id BIGINT UNSIGNED,
channel_id BIGINT UNSIGNED,
value VARCHAR(2000) NOT NULL,
PRIMARY KEY (id),
INDEX (user_id),
INDEX (guild_id),
INDEX (channel_id)
);
INSERT INTO reminders.todos_new (user_id, guild_id, channel_id, value)
SELECT users.user, guilds.guild, channels.channel, todos.value
FROM todos
INNER JOIN users ON users.id = todos.user_id
INNER JOIN guilds ON guilds.id = todos.guild_id
INNER JOIN channels ON channels.id = todos.channel_id;