From 7f2e963b524d7685645ceff48fb5e6c6a47f7813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Brigand=C3=AC?= Date: Thu, 1 Nov 2018 19:10:46 +0100 Subject: [PATCH] Drop ON UPDATE CURRENT_TIMESTAMP(6) from non-null TIMESTAMP columns Fixes #283 --- ...or-mysql-timestamp-default-value-2101.yaml | 24 +++++++++++++++++++ .../db.orchestrator.changelog-master.yaml | 3 +++ 2 files changed, 27 insertions(+) create mode 100644 src/main/resources/db/changelog/0003_orchestrator-mysql-timestamp-default-value-2101.yaml diff --git a/src/main/resources/db/changelog/0003_orchestrator-mysql-timestamp-default-value-2101.yaml b/src/main/resources/db/changelog/0003_orchestrator-mysql-timestamp-default-value-2101.yaml new file mode 100644 index 0000000000..a6ae8c4a40 --- /dev/null +++ b/src/main/resources/db/changelog/0003_orchestrator-mysql-timestamp-default-value-2101.yaml @@ -0,0 +1,24 @@ +databaseChangeLog: +- changeSet: + id: 0003_orchestrator-mysql-timestamp-default-value-2101 + author: a.brigandi + comment: > + Set the default value as CURRENT_TIMESTAMP(6) for non-nullable TIMESTAMP columns in MySql. + This is needed to fix the default behaviour of MySql of appending + ON UPDATE CURRENT_TIMESTAMP(6) in the default value of non-nullable TIMESTAMP columns + changes: + - sql: + dbms: mysql + sql: > + ALTER TABLE `deployment` + CHANGE COLUMN `created_at` `created_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) + - sql: + dbms: mysql + sql: > + ALTER TABLE `resource` + CHANGE COLUMN `created_at` `created_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) + - sql: + dbms: mysql + sql: > + ALTER TABLE `oidc_refresh_token` + CHANGE COLUMN `issued_at` `issued_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) diff --git a/src/main/resources/db/changelog/db.orchestrator.changelog-master.yaml b/src/main/resources/db/changelog/db.orchestrator.changelog-master.yaml index 209109859d..2f7a00ccc1 100644 --- a/src/main/resources/db/changelog/db.orchestrator.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.orchestrator.changelog-master.yaml @@ -2,3 +2,6 @@ databaseChangeLog: - include: - file: 0002_orchestrator-create-2001.yaml relativeToChangelogFile: true + - include: + - file: 0003_orchestrator-mysql-timestamp-default-value-2101.yaml + relativeToChangelogFile: true