diff --git a/Cargo.lock b/Cargo.lock index 5730115..b2c14d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2645,9 +2645,9 @@ dependencies = [ [[package]] name = "rocket_dyn_templates" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04bfc006e547e4f72b760ab861f5943b688aed8a82c4977b5500c98f5d17dbfa" +checksum = "5bbab919c9e67df3f7ac6624a32ef897df4cd61c0969f4d66f3ced0534660d7a" dependencies = [ "normpath", "notify", diff --git a/Cargo.toml b/Cargo.toml index 4bf6fdb..3bb31f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ secrecy = "0.8.0" futures = "0.3.30" prometheus = "0.13.3" rocket = { version = "0.5.0", features = ["tls", "secrets", "json"] } -rocket_dyn_templates = { version = "0.1.0", features = ["tera"] } +rocket_dyn_templates = { version = "0.2.0", features = ["tera"] } serenity = { version = "0.12", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] } oauth2 = "4" csv = "1.2" diff --git a/migrations/20210603000000_initial.sql b/migrations/20210603000000_initial.sql index e1527dc..aca6864 100644 --- a/migrations/20210603000000_initial.sql +++ b/migrations/20210603000000_initial.sql @@ -136,9 +136,9 @@ CREATE TABLE reminders ( set_by INT UNSIGNED, PRIMARY KEY (id), - FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE RESTRICT, - FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE, - FOREIGN KEY (set_by) REFERENCES users(id) ON DELETE SET NULL + CONSTRAINT `reminder_message_fk` FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE RESTRICT, + CONSTRAINT `reminder_channel_fk` FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE, + CONSTRAINT `reminder_user_fk` FOREIGN KEY (set_by) REFERENCES users(id) ON DELETE SET NULL ); CREATE TRIGGER message_cleanup AFTER DELETE ON reminders @@ -157,9 +157,9 @@ CREATE TABLE todos ( value VARCHAR(2000) NOT NULL, PRIMARY KEY (id), - FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL, - FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE, - FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE SET NULL + CONSTRAINT todos_ibfk_5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL, + CONSTRAINT todos_ibfk_4 FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE, + CONSTRAINT todos_ibfk_3 FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE SET NULL ); CREATE TABLE command_restrictions ( diff --git a/migrations/20210623000000_reminder_message_embed.sql b/migrations/20210623000000_reminder_message_embed.sql index e6b83cb..3293f36 100644 --- a/migrations/20210623000000_reminder_message_embed.sql +++ b/migrations/20210623000000_reminder_message_embed.sql @@ -46,7 +46,7 @@ CREATE TABLE reminders_new ( PRIMARY KEY (id), FOREIGN KEY (`channel_id`) REFERENCES channels (`id`) ON DELETE CASCADE, - FOREIGN KEY (`set_by`) REFERENCES users (`id`) ON DELETE SET NULL + CONSTRAINT `reminders_ibfk_2` FOREIGN KEY (`set_by`) REFERENCES `users` (`id`) ON DELETE SET NULL # disallow having a reminder as restartable if it has no interval -- , CONSTRAINT restartable_interval_mutex CHECK (`restartable` = 0 OR `interval` IS NULL) diff --git a/migrations/20240630150936_dashboard_preferences.sql b/migrations/20240630150936_dashboard_preferences.sql index 2069663..4e33e69 100644 --- a/migrations/20240630150936_dashboard_preferences.sql +++ b/migrations/20240630150936_dashboard_preferences.sql @@ -1,3 +1,7 @@ +-- Tables no longer needed as old dashboard is decomm. +DROP TABLE guild_users; +DROP TABLE events; + ALTER TABLE users ADD COLUMN `reset_inputs_on_create` BOOLEAN NOT NULL DEFAULT 0; ALTER TABLE users ADD COLUMN `use_browser_timezone` BOOLEAN NOT NULL DEFAULT 1; ALTER TABLE users ADD COLUMN `dashboard_color_scheme` ENUM('system', 'light', 'dark') NOT NULL DEFAULT 'system'; @@ -7,4 +11,14 @@ ALTER TABLE users DROP COLUMN `patreon`; ALTER TABLE users DROP COLUMN `name`; ALTER TABLE users DROP PRIMARY KEY, ADD PRIMARY KEY (`user`); + +ALTER TABLE todos DROP CONSTRAINT todos_ibfk_5, MODIFY COLUMN user_id BIGINT UNSIGNED; +UPDATE todos SET user_id = (SELECT user FROM users WHERE id = user_id); +ALTER TABLE todos ADD CONSTRAINT todos_user_fk FOREIGN KEY (user_id) REFERENCES users(user); + +ALTER TABLE reminders DROP CONSTRAINT reminders_ibfk_2, MODIFY COLUMN set_by BIGINT UNSIGNED; +UPDATE reminders SET set_by = (SELECT user FROM users WHERE id = set_by); +ALTER TABLE reminders ADD CONSTRAINT reminder_user_fk FOREIGN KEY (set_by) REFERENCES users(user); + +ALTER TABLE users DROP COLUMN `id`; ALTER TABLE users RENAME COLUMN `user` TO `id`; diff --git a/reminder-dashboard/index.html b/reminder-dashboard/index.html index f3703ab..7443c6e 100644 --- a/reminder-dashboard/index.html +++ b/reminder-dashboard/index.html @@ -22,7 +22,6 @@