From c41d9829ad6170c5fd31bd0cc25022515d295779 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 16 Oct 2015 18:09:04 +0200 Subject: [PATCH] schema/mysql: switch deployment to config_checksum --- schema/mysql-changes/upgrade_40.sql | 9 +++++++++ schema/mysql.sql | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 schema/mysql-changes/upgrade_40.sql diff --git a/schema/mysql-changes/upgrade_40.sql b/schema/mysql-changes/upgrade_40.sql new file mode 100644 index 00000000..55bcbedb --- /dev/null +++ b/schema/mysql-changes/upgrade_40.sql @@ -0,0 +1,9 @@ + +ALTER TABLE director_deployment_log ADD COLUMN config_checksum VARBINARY(20) DEFAULT NULL AFTER config_id; +ALTER TABLE director_deployment_log DROP COLUMN config_id; +ALTER TABLE director_deployment_log ADD CONSTRAINT config_checksum + FOREIGN KEY config_checksum (config_checksum) + REFERENCES director_generated_config (checksum) + ON DELETE SET NULL + ON UPDATE RESTRICT; + diff --git a/schema/mysql.sql b/schema/mysql.sql index 256b25d8..376e3daf 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -75,7 +75,7 @@ CREATE TABLE director_generated_config_file ( CREATE TABLE director_deployment_log ( id BIGINT(20) UNSIGNED AUTO_INCREMENT NOT NULL, - config_id BIGINT(20) UNSIGNED NOT NULL, + config_checksum VARBINARY(20) DEFAULT NULL, peer_identity VARCHAR(64) NOT NULL, start_time DATETIME NOT NULL, end_time DATETIME DEFAULT NULL, @@ -91,7 +91,12 @@ CREATE TABLE director_deployment_log ( startup_succeeded ENUM('y', 'n') DEFAULT NULL, username VARCHAR(64) DEFAULT NULL COMMENT 'The user that triggered this deployment', startup_log TEXT DEFAULT NULL, - PRIMARY KEY (id) + PRIMARY KEY (id), + CONSTRAINT config_checksum + FOREIGN KEY config_checksum (config_checksum) + REFERENCES director_generated_config (checksum) + ON DELETE SET NULL + ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE director_datalist (