Schema: Update timestamp & set success of existing schema version entry

This commit is contained in:
Yonas Habteab 2023-09-13 15:30:13 +02:00 committed by Johannes Meyer
parent ac24c6d34b
commit 80ac314d8b
2 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,8 @@ ALTER TABLE icingaweb_schema
DROP CONSTRAINT IF EXISTS idx_icingaweb_schema_version,
ADD CONSTRAINT idx_icingaweb_schema_version UNIQUE (version);
UPDATE icingaweb_schema SET timestamp = timestamp * 1000, success = 'y';
INSERT INTO icingaweb_schema (version, timestamp, success, reason)
VALUES('2.12.0', UNIX_TIMESTAMP() * 1000, 'y', NULL)
ON DUPLICATE KEY UPDATE timestamp = VALUES(timestamp), success = VALUES(success), reason = VALUES(reason);

View File

@ -8,6 +8,8 @@ ALTER TABLE icingaweb_schema
DROP CONSTRAINT IF EXISTS idx_icingaweb_schema_version,
ADD CONSTRAINT idx_icingaweb_schema_version UNIQUE (version);
UPDATE icingaweb_schema SET timestamp = timestamp * 1000, success = 'y';
INSERT INTO icingaweb_schema (version, timestamp, success, reason)
VALUES('2.12.0', EXTRACT(EPOCH FROM now()) * 1000, 'y', NULL)
ON CONFLICT ON CONSTRAINT idx_icingaweb_schema_version DO UPDATE SET timestamp = EXCLUDED.timestamp, success = EXCLUDED.success, reason = EXCLUDED.reason;