schema/mysql: Use UNIX_TIMESTAMP() instead of CURRENT_TIMESTMAP()

`CURRENT_TIMESTAMP()` an alias for `NOW()` returns the current date and
time in the format `YYYY-MM-DD hh:mm:ss` using the session time zone.
Since we are using numeric context, the value is stored in the format
`YYYYMMDDhhmmss`. But actually we want to set a (millisecond) UNIX
timestamp here, so we need to use `UNIX_TIMESTAMP()` instead.
This commit is contained in:
Eric Lippmann 2024-03-18 10:22:35 +01:00
parent 41ff8deb26
commit dd75a5edbc
4 changed files with 4 additions and 4 deletions

View file

@ -1343,4 +1343,4 @@ CREATE TABLE icingadb_schema (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
INSERT INTO icingadb_schema (version, timestamp)
VALUES (4, CURRENT_TIMESTAMP() * 1000);
VALUES (4, UNIX_TIMESTAMP() * 1000);

View file

@ -156,7 +156,7 @@ ALTER TABLE acknowledgement_history
MODIFY is_persistent enum('n','y') DEFAULT NULL COMMENT 'NULL if ack_set event happened before Icinga DB history recording';
INSERT INTO icingadb_schema (version, timestamp)
VALUES (2, CURRENT_TIMESTAMP() * 1000);
VALUES (2, UNIX_TIMESTAMP() * 1000);
ALTER TABLE host_state
MODIFY output longtext DEFAULT NULL,

View file

@ -288,4 +288,4 @@ INSERT INTO sla_history_downtime
ON DUPLICATE KEY UPDATE sla_history_downtime.downtime_id = sla_history_downtime.downtime_id;
INSERT INTO icingadb_schema (version, TIMESTAMP)
VALUES (3, CURRENT_TIMESTAMP() * 1000);
VALUES (3, UNIX_TIMESTAMP() * 1000);

View file

@ -34,4 +34,4 @@ ALTER TABLE history
UNLOCK TABLES;
INSERT INTO icingadb_schema (version, timestamp)
VALUES (4, CURRENT_TIMESTAMP() * 1000);
VALUES (4, UNIX_TIMESTAMP() * 1000);