From 3d8a817b04e98244248c2c375192f0f89a79489b Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Fri, 30 Aug 2024 14:23:52 -0600 Subject: [PATCH] bwuh --- migrations/3 - TTS.sql | 7 ++++++- migrations/4 - Add Cooldown.sql | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/migrations/3 - TTS.sql b/migrations/3 - TTS.sql index c66a8f7..6528d36 100644 --- a/migrations/3 - TTS.sql +++ b/migrations/3 - TTS.sql @@ -1,4 +1,9 @@ -- Add ttsOverride column to the accounts table -ALTER TABLE 'accounts' ADD COLUMN IF NOT EXISTS 'ttsOverride' INTEGER NOT NULL DEFAULT 0; +SELECT COUNT(*) +FROM pragma_table_info('accounts') +WHERE name = 'ttsOverride'; + +-- Step 2: If the count is 0, add the 'cooldown' column +ALTER TABLE accounts ADD COLUMN ttsOverride TEXT INTEGER NOT NULL DEFAULT 0; -- Retroactively set ttsOverride to 0 for all accounts that dont have it set at all UPDATE 'accounts' SET 'ttsOverride' = 0 WHERE 'ttsOverride' IS NULL; \ No newline at end of file diff --git a/migrations/4 - Add Cooldown.sql b/migrations/4 - Add Cooldown.sql index 5ee2637..85de514 100644 --- a/migrations/4 - Add Cooldown.sql +++ b/migrations/4 - Add Cooldown.sql @@ -1,2 +1,9 @@ -- Add ttsOverride column to the accounts table -ALTER TABLE 'accounts' ADD COLUMN IF NOT EXISTS 'cooldown' TEXT; \ No newline at end of file +--ALTER TABLE 'accounts' ADD COLUMN 'cooldown' TEXT; +-- Step 1: Check if 'cooldown' column exists in 'accounts' table +SELECT COUNT(*) +FROM pragma_table_info('accounts') +WHERE name = 'cooldown'; + +-- Step 2: If the count is 0, add the 'cooldown' column +ALTER TABLE accounts ADD COLUMN cooldown TEXT;