diff --git a/schema/mysql-upgrades/2.12.0.sql b/schema/mysql-upgrades/2.12.0.sql index cb377df82..f2630ac34 100644 --- a/schema/mysql-upgrades/2.12.0.sql +++ b/schema/mysql-upgrades/2.12.0.sql @@ -1,13 +1,11 @@ ALTER TABLE icingaweb_schema MODIFY COLUMN timestamp bigint unsigned NOT NULL, MODIFY COLUMN version varchar(64) NOT NULL, - ADD COLUMN IF NOT EXISTS success enum('n', 'y') DEFAULT NULL, - ADD COLUMN IF NOT EXISTS reason text DEFAULT NULL, - DROP CONSTRAINT IF EXISTS idx_icingaweb_schema_version, + ADD COLUMN success enum('n', 'y') DEFAULT NULL, + ADD COLUMN reason text DEFAULT NULL, 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); + VALUES('2.12.0', UNIX_TIMESTAMP() * 1000, 'y', NULL); diff --git a/schema/pgsql-upgrades/2.12.0.sql b/schema/pgsql-upgrades/2.12.0.sql index 706a28c69..2a5818e5e 100644 --- a/schema/pgsql-upgrades/2.12.0.sql +++ b/schema/pgsql-upgrades/2.12.0.sql @@ -5,11 +5,9 @@ ALTER TABLE icingaweb_schema ALTER COLUMN version TYPE varchar(64), ADD COLUMN success boolenum DEFAULT NULL, ADD COLUMN reason text DEFAULT NULL, - 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; + VALUES('2.12.0', EXTRACT(EPOCH FROM now()) * 1000, 'y', NULL);