From 0664da8f12b21893facd87412678b77ca880e8c3 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 12 Mar 2021 16:52:44 +0100 Subject: [PATCH] schema: allow NULL for purge_action --- schema/mysql-migrations/upgrade_173.sql | 6 ++++++ schema/mysql.sql | 4 ++-- schema/pgsql-migrations/upgrade_173.sql | 6 ++++++ schema/pgsql.sql | 4 ++-- 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 schema/mysql-migrations/upgrade_173.sql create mode 100644 schema/pgsql-migrations/upgrade_173.sql diff --git a/schema/mysql-migrations/upgrade_173.sql b/schema/mysql-migrations/upgrade_173.sql new file mode 100644 index 00000000..609f7836 --- /dev/null +++ b/schema/mysql-migrations/upgrade_173.sql @@ -0,0 +1,6 @@ +ALTER TABLE sync_rule + MODIFY COLUMN purge_action ENUM('delete', 'disable') NULL DEFAULT NULL; + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (173, NOW()); diff --git a/schema/mysql.sql b/schema/mysql.sql index d421234b..87d04d99 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -1526,7 +1526,7 @@ CREATE TABLE sync_rule ( ) NOT NULL, update_policy ENUM('merge', 'override', 'ignore', 'update-only') NOT NULL, purge_existing ENUM('y', 'n') NOT NULL DEFAULT 'n', - purge_action ENUM('delete', 'disable') NOT NULL, + purge_action ENUM('delete', 'disable') NULL DEFAULT NULL, filter_expression TEXT DEFAULT NULL, sync_state ENUM( 'unknown', @@ -1884,4 +1884,4 @@ CREATE TABLE icinga_scheduled_downtime_range ( INSERT INTO director_schema_migration (schema_version, migration_time) - VALUES (172, NOW()); + VALUES (173, NOW()); diff --git a/schema/pgsql-migrations/upgrade_173.sql b/schema/pgsql-migrations/upgrade_173.sql new file mode 100644 index 00000000..fdd1b147 --- /dev/null +++ b/schema/pgsql-migrations/upgrade_173.sql @@ -0,0 +1,6 @@ +ALTER TABLE sync_rule + ALTER COLUMN purge_action SET DEFAULT NULL; + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (173, NOW()); diff --git a/schema/pgsql.sql b/schema/pgsql.sql index ac554e55..a404acc7 100644 --- a/schema/pgsql.sql +++ b/schema/pgsql.sql @@ -1691,7 +1691,7 @@ CREATE TABLE sync_rule ( object_type enum_sync_rule_object_type NOT NULL, update_policy enum_sync_rule_update_policy NOT NULL, purge_existing enum_boolean NOT NULL DEFAULT 'n', - purge_action enum_sync_rule_purge_action NOT NULL, + purge_action enum_sync_rule_purge_action NULL DEFAULT NULL, filter_expression text DEFAULT NULL, sync_state enum_sync_state NOT NULL DEFAULT 'unknown', last_error_message text NULL DEFAULT NULL, @@ -2201,4 +2201,4 @@ COMMENT ON COLUMN icinga_scheduled_downtime_range.merge_behaviour IS 'set -> = { INSERT INTO director_schema_migration (schema_version, migration_time) - VALUES (172, NOW()); + VALUES (173, NOW());