Skip to content

Commit 63dac34

Browse files
committed
director_job: Change timestamp data types to integer
1 parent 5f4ad0f commit 63dac34

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ALTER TABLE director_job ADD COLUMN ts_last_attempt_tmp BIGINT(20) DEFAULT NULL;
2+
ALTER TABLE director_job ADD COLUMN ts_last_error_tmp BIGINT(20) DEFAULT NULL;
3+
4+
5+
UPDATE director_job
6+
SET ts_last_attempt_tmp = UNIX_TIMESTAMP(ts_last_attempt) * 1000,
7+
ts_last_error_tmp = UNIX_TIMESTAMP(ts_last_error) * 1000;
8+
9+
ALTER TABLE director_job
10+
DROP COLUMN ts_last_attempt,
11+
DROP COLUMN ts_last_error,
12+
CHANGE ts_last_attempt_tmp ts_last_attempt BIGINT(20) DEFAULT NULL,
13+
CHANGE ts_last_error_tmp ts_last_error BIGINT(20) DEFAULT NULL;
14+
15+
INSERT INTO director_schema_migration
16+
(schema_version, migration_time)
17+
VALUES (189, NOW());

schema/mysql.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ CREATE TABLE director_job (
347347
run_interval INT(10) UNSIGNED NOT NULL, -- seconds
348348
timeperiod_id INT(10) UNSIGNED DEFAULT NULL,
349349
last_attempt_succeeded ENUM('y', 'n') DEFAULT NULL,
350-
ts_last_attempt TIMESTAMP NULL DEFAULT NULL,
351-
ts_last_error TIMESTAMP NULL DEFAULT NULL,
350+
ts_last_attempt BIGINT(20) NULL DEFAULT NULL,
351+
ts_last_error BIGINT(20) NULL DEFAULT NULL,
352352
last_error_message TEXT DEFAULT NULL,
353353
PRIMARY KEY (id),
354354
UNIQUE KEY (job_name),
@@ -2446,4 +2446,4 @@ CREATE TABLE branched_icinga_dependency (
24462446

24472447
INSERT INTO director_schema_migration
24482448
(schema_version, migration_time)
2449-
VALUES (188, NOW());
2449+
VALUES (189, NOW());
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ALTER TABLE director_job ADD COLUMN ts_last_attempt_tmp bigint DEFAULT NULL;
2+
ALTER TABLE director_job ADD COLUMN ts_last_error_tmp bigint DEFAULT NULL;
3+
4+
5+
UPDATE director_job
6+
SET ts_last_attempt_tmp = UNIX_TIMESTAMP(ts_last_attempt) * 1000,
7+
ts_last_error_tmp = UNIX_TIMESTAMP(ts_last_error) * 1000;
8+
9+
ALTER TABLE director_job
10+
DROP COLUMN ts_last_attempt,
11+
DROP COLUMN ts_last_error;
12+
13+
ALTER TABLE director_job RENAME COLUMN ts_last_attempt_tmp TO ts_last_attempt;
14+
ALTER TABLE director_job RENAME COLUMN ts_last_error_tmp TO ts_last_error;
15+
16+
INSERT INTO director_schema_migration
17+
(schema_version, migration_time)
18+
VALUES (189, NOW());

schema/pgsql.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ CREATE TABLE director_job (
448448
run_interval integer NOT NULL, -- seconds
449449
timeperiod_id integer DEFAULT NULL,
450450
last_attempt_succeeded enum_boolean DEFAULT NULL,
451-
ts_last_attempt timestamp with time zone DEFAULT NULL,
452-
ts_last_error timestamp with time zone DEFAULT NULL,
451+
ts_last_attempt bigint DEFAULT NULL,
452+
ts_last_error bigint DEFAULT NULL,
453453
last_error_message text NULL DEFAULT NULL,
454454
CONSTRAINT director_job_period
455455
FOREIGN KEY (timeperiod_id)
@@ -2781,4 +2781,4 @@ CREATE INDEX branched_dependency_search_object_name ON branched_icinga_dependenc
27812781

27822782
INSERT INTO director_schema_migration
27832783
(schema_version, migration_time)
2784-
VALUES (187, NOW());
2784+
VALUES (189, NOW());

0 commit comments

Comments
 (0)