diff --git a/bot/constants.py b/bot/constants.py index 4594570a..6c122bcc 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -1,2 +1,2 @@ CONFIG_FILE = "config/bot.conf" -DATA_VERSION = 7 +DATA_VERSION = 8 diff --git a/data/migration/v7-v8/migration.sql b/data/migration/v7-v8/migration.sql new file mode 100644 index 00000000..d93850e8 --- /dev/null +++ b/data/migration/v7-v8/migration.sql @@ -0,0 +1,18 @@ +ALTER TABLE guild_config ADD COLUMN pomodoro_channel BIGINT; + +-- Timer Data {{{ +create TABLE timers( + channelid BIGINT PRIMARY KEY, + guildid BIGINT NOT NULL REFERENCES guild_config (guildid), + text_channelid BIGINT, + focus_length INTEGER NOT NULL, + break_length INTEGER NOT NULL, + last_started TIMESTAMPTZ NOT NULL, + inactivity_threshold INTEGER, + channel_name TEXT, + pretty_name TEXT +); +CREATE INDEX timers_guilds ON timers (guildid); +-- }}} + +INSERT INTO VersionHistory (version, author) VALUES (8, 'v7-v8 migration'); diff --git a/data/schema.sql b/data/schema.sql index 928d143d..b82e8cc5 100644 --- a/data/schema.sql +++ b/data/schema.sql @@ -4,7 +4,7 @@ CREATE TABLE VersionHistory( time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL, author TEXT ); -INSERT INTO VersionHistory (version, author) VALUES (7, 'Initial Creation'); +INSERT INTO VersionHistory (version, author) VALUES (8, 'Initial Creation'); CREATE OR REPLACE FUNCTION update_timestamp_column()