[MM-40952] migrations: Add if statements for some queries (#19359)
* migrations: add if statements for some queries * add better checks to upgrade posts v6 migration * use "is null" instead of "= null" * fix down script for users v6 * reflect review comments
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
509f49c813
Коммит
56c7da5817
@@ -19,4 +19,19 @@ CREATE INDEX IF NOT EXISTS idx_sessions_expires_at ON sessions (expiresat);
|
||||
CREATE INDEX IF NOT EXISTS idx_sessions_create_at ON sessions (createat);
|
||||
CREATE INDEX IF NOT EXISTS idx_sessions_last_activity_at ON sessions (lastactivityat);
|
||||
|
||||
DELETE FROM sessions where expiresat > 3000000000000;
|
||||
DO $$
|
||||
<< migrate_if_version_below_5120 >>
|
||||
DECLARE
|
||||
current_db_version VARCHAR(100) := '';
|
||||
BEGIN
|
||||
SELECT
|
||||
value INTO current_db_version
|
||||
FROM
|
||||
systems
|
||||
WHERE
|
||||
name = 'Version';
|
||||
IF (string_to_array(current_db_version, '.') < string_to_array('5.12.0', '.')) THEN
|
||||
DELETE FROM sessions where expiresat > 3000000000000;
|
||||
END IF;
|
||||
END migrate_if_version_below_5120
|
||||
$$;
|
||||
|
||||
Ссылка в новой задаче
Block a user