diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_10__change_length_of_target_attributes_key___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_10__change_length_of_target_attributes_key___DB2.sql index 72cce7308..cdcffc506 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_10__change_length_of_target_attributes_key___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_10__change_length_of_target_attributes_key___DB2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_target_attributes - ALTER COLUMN attribute_key SET DATA TYPE VARCHAR(128); \ No newline at end of file +ALTER TABLE sp_target_attributes ALTER COLUMN attribute_key SET DATA TYPE VARCHAR(128); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_11__add_auto_assign_action_type___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_11__add_auto_assign_action_type___DB2.sql index 67405670e..9c6b67bf3 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_11__add_auto_assign_action_type___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_11__add_auto_assign_action_type___DB2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_target_filter_query - ADD COLUMN auto_assign_action_type INTEGER; \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_action_type INTEGER; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_12__change_length_of_controller_id_and_name___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_12__change_length_of_controller_id_and_name___DB2.sql index 5db3dc2e5..fc5d4f0f0 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_12__change_length_of_controller_id_and_name___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_12__change_length_of_controller_id_and_name___DB2.sql @@ -1,24 +1,13 @@ -ALTER TABLE sp_distribution_set - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_distribution_set_type - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_distributionset_tag - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_base_software_module - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_rollout - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_rolloutgroup - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_software_module_type - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_target - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_target_filter_query - ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_target_tag - ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_distribution_set ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_distribution_set_type ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_distributionset_tag ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_base_software_module ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_rollout ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_rolloutgroup ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_software_module_type ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_target ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_target_filter_query ALTER COLUMN name SET DATA TYPE VARCHAR(128); +ALTER TABLE sp_target_tag ALTER COLUMN name SET DATA TYPE VARCHAR(128); -ALTER TABLE sp_target - ALTER COLUMN controller_id SET DATA TYPE VARCHAR(256); +ALTER TABLE sp_target ALTER COLUMN controller_id SET DATA TYPE VARCHAR(256); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_13__add_action_external_id___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_13__add_action_external_id___DB2.sql index 2556b7d21..8dbda293f 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_13__add_action_external_id___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_13__add_action_external_id___DB2.sql @@ -1,5 +1,4 @@ -ALTER TABLE sp_action - ADD COLUMN external_ref VARCHAR(512); +ALTER TABLE sp_action ADD COLUMN external_ref VARCHAR(512); CREATE INDEX sp_idx_action_external_ref ON sp_action (external_ref); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_14__add_sha256_hash___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_14__add_sha256_hash___DB2.sql index bfe56f337..ca7e53fce 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_14__add_sha256_hash___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_14__add_sha256_hash___DB2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_artifact - ADD COLUMN sha256_hash CHAR(64); \ No newline at end of file +ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_15__add_weight___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_15__add_weight___DB2.sql index 12db78a80..9eaad20e1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_15__add_weight___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_15__add_weight___DB2.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_action - ADD weight INT; -ALTER TABLE sp_rollout - ADD weight INT; -ALTER TABLE sp_target_filter_query - ADD auto_assign_weight INT; +ALTER TABLE sp_action ADD weight INT; +ALTER TABLE sp_rollout ADD weight INT; +ALTER TABLE sp_target_filter_query ADD auto_assign_weight INT; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_16__add_action_initiated_by___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_16__add_action_initiated_by___DB2.sql index 70f33d1d5..6d00f9f50 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_16__add_action_initiated_by___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_16__add_action_initiated_by___DB2.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_action - ADD COLUMN initiated_by VARCHAR(64) NOT NULL DEFAULT ''; -ALTER TABLE sp_action - ALTER COLUMN initiated_by DROP DEFAULT; -ALTER TABLE sp_target_filter_query - ADD COLUMN auto_assign_initiated_by VARCHAR(64); +ALTER TABLE sp_action ADD COLUMN initiated_by VARCHAR(64) NOT NULL DEFAULT ''; +ALTER TABLE sp_action ALTER COLUMN initiated_by DROP DEFAULT; +ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_initiated_by VARCHAR(64); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_18__add_target_type___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_18__add_target_type___DB2.sql index 99d2bbcfd..fed3796ff 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_18__add_target_type___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_18__add_target_type___DB2.sql @@ -1,14 +1,14 @@ CREATE TABLE sp_target_type ( id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, + tenant VARCHAR(40) NOT NULL, colour VARCHAR(16), - created_at BIGINT NOT NULL, - created_by VARCHAR(64) NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(64) NOT NULL, description VARCHAR(512), - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(64) NOT NULL, - name VARCHAR(64) NOT NULL, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(64) NOT NULL, + name VARCHAR(64) NOT NULL, optlock_revision INTEGER, PRIMARY KEY (id) ); @@ -18,20 +18,15 @@ CREATE INDEX sp_idx_target_type_prim CREATE TABLE sp_target_type_ds_type_relation ( - target_type BIGINT NOT NULL, - distribution_set_type BIGINT NOT NULL, + target_type BIGINT NOT NULL, + distribution_set_type BIGINT NOT NULL, PRIMARY KEY (target_type, distribution_set_type) ); -ALTER TABLE sp_target_type - ADD CONSTRAINT uk_target_type_name UNIQUE (name, tenant); +ALTER TABLE sp_target_type ADD CONSTRAINT uk_target_type_name UNIQUE (name, tenant); -ALTER TABLE sp_target - ADD COLUMN target_type BIGINT; -ALTER TABLE sp_target - ADD CONSTRAINT fk_target_relation_target_type FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE SET NULL; +ALTER TABLE sp_target ADD COLUMN target_type BIGINT; +ALTER TABLE sp_target ADD CONSTRAINT fk_target_relation_target_type FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE SET NULL; -ALTER TABLE sp_target_type_ds_type_relation - ADD CONSTRAINT fk_target_type_relation_target_type FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE CASCADE; -ALTER TABLE sp_target_type_ds_type_relation - ADD CONSTRAINT fk_target_type_relation_ds_type FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE; \ No newline at end of file +ALTER TABLE sp_target_type_ds_type_relation ADD CONSTRAINT fk_target_type_relation_target_type FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE CASCADE; +ALTER TABLE sp_target_type_ds_type_relation ADD CONSTRAINT fk_target_type_relation_ds_type FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_19__add_valid_flag_to_ds___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_19__add_valid_flag_to_ds___DB2.sql index 352419711..3ab0e7502 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_19__add_valid_flag_to_ds___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_19__add_valid_flag_to_ds___DB2.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_distribution_set - ADD COLUMN valid BOOLEAN; +ALTER TABLE sp_distribution_set ADD COLUMN valid BOOLEAN; -UPDATE sp_distribution_set -SET valid = 1; \ No newline at end of file +UPDATE sp_distribution_set SET valid = 1; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_20__add_encryption_flag_to_sm___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_20__add_encryption_flag_to_sm___DB2.sql index 5dd518204..9249d14a1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_20__add_encryption_flag_to_sm___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_20__add_encryption_flag_to_sm___DB2.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_base_software_module - ADD COLUMN encrypted BOOLEAN; +ALTER TABLE sp_base_software_module ADD COLUMN encrypted BOOLEAN; -UPDATE sp_base_software_module -SET encrypted = 0; \ No newline at end of file +UPDATE sp_base_software_module SET encrypted = 0; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_22__change_target_type_name_length___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_22__change_target_type_name_length___DB2.sql index b52051eb9..e7f6f7624 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_22__change_target_type_name_length___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_22__change_target_type_name_length___DB2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_target_type - ALTER COLUMN name SET DATA TYPE VARCHAR(128); \ No newline at end of file +ALTER TABLE sp_target_type ALTER COLUMN name SET DATA TYPE VARCHAR(128); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_23__add_action_status_code___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_23__add_action_status_code___DB2.sql index ff27e35bf..c88711e47 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_23__add_action_status_code___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_23__add_action_status_code___DB2.sql @@ -1,3 +1,2 @@ -ALTER TABLE sp_action_status - ADD COLUMN code INTEGER; +ALTER TABLE sp_action_status ADD COLUMN code INTEGER; CREATE INDEX sp_idx_action_status_03 ON sp_action_status (tenant, code); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_24__add_last_action_status_code___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_24__add_last_action_status_code___DB2.sql index 5bc473139..ee8e263bd 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_24__add_last_action_status_code___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_24__add_last_action_status_code___DB2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_action - ADD COLUMN last_action_status_code INTEGER; \ No newline at end of file +ALTER TABLE sp_action ADD COLUMN last_action_status_code INTEGER; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_25__add_confirmation_flag___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_25__add_confirmation_flag___DB2.sql index 8287ce1e6..5c16b5d34 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_25__add_confirmation_flag___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_25__add_confirmation_flag___DB2.sql @@ -1,25 +1,21 @@ -ALTER TABLE sp_rolloutgroup - ADD COLUMN confirmation_required BOOLEAN; -UPDATE sp_rolloutgroup -SET confirmation_required = 0; +ALTER TABLE sp_rolloutgroup ADD COLUMN confirmation_required BOOLEAN; +UPDATE sp_rolloutgroup SET confirmation_required = 0; -ALTER TABLE sp_target_filter_query - ADD COLUMN confirmation_required BOOLEAN; -UPDATE sp_target_filter_query -SET confirmation_required = 0; +ALTER TABLE sp_target_filter_query ADD COLUMN confirmation_required BOOLEAN; +UPDATE sp_target_filter_query SET confirmation_required = 0; CREATE TABLE sp_target_conf_status ( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - target_id bigint not null, - initiator VARCHAR(64), - remark VARCHAR(512), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) not null, + id BIGINT GENERATED always AS IDENTITY NOT NULL, + target_id bigint not null, + initiator VARCHAR(64), + remark VARCHAR(512), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) not null, primary key (id) ); ALTER TABLE sp_target_conf_status diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_26__add_access_control_context___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_26__add_access_control_context___DB2.sql index fb06922c7..ccf16963e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_26__add_access_control_context___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_26__add_access_control_context___DB2.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_target_filter_query - ADD COLUMN access_control_context VARCHAR(4096); -ALTER TABLE sp_rollout - ADD COLUMN access_control_context VARCHAR(4096); \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD COLUMN access_control_context VARCHAR(4096); +ALTER TABLE sp_rollout ADD COLUMN access_control_context VARCHAR(4096); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_27__target_type_inherit_type___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_27__target_type_inherit_type___DB2.sql index 2b63926eb..86e3350b8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_27__target_type_inherit_type___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_27__target_type_inherit_type___DB2.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_target_type - ADD COLUMN type_key VARCHAR(64) NOT NULL DEFAULT ('_'); -UPDATE sp_target_type -SET type_key = name; -ALTER TABLE sp_target_type - ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file +ALTER TABLE sp_target_type ADD COLUMN type_key VARCHAR (64) NOT NULL DEFAULT ('_'); +UPDATE sp_target_type SET type_key = name; +ALTER TABLE sp_target_type ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_28__add_dynamic_rollout___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_28__add_dynamic_rollout___DB2.sql index 33b76ee8e..cff85ae84 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_28__add_dynamic_rollout___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_28__add_dynamic_rollout___DB2.sql @@ -1,20 +1,9 @@ -ALTER TABLE sp_rollout - ADD COLUMN is_dynamic BOOLEAN; -ALTER TABLE sp_rolloutgroup - ADD COLUMN is_dynamic BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE sp_rollout ADD COLUMN is_dynamic BOOLEAN; +ALTER TABLE sp_rolloutgroup ADD COLUMN is_dynamic BOOLEAN NOT NULL DEFAULT false; -UPDATE sp_rollout -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_action -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_target_filter_query -SET auto_assign_weight = 1000 -WHERE auto_assign_weight IS NULL; -ALTER TABLE sp_rollout - ALTER COLUMN weight SET NOT NULL; -ALTER TABLE sp_action - ALTER COLUMN weight SET NOT NULL; -ALTER TABLE sp_target_filter_query - ALTER COLUMN auto_assign_weight SET NOT NULL; +UPDATE sp_rollout SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_action SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_target_filter_query SET auto_assign_weight = 1000 WHERE auto_assign_weight IS NULL; +ALTER TABLE sp_rollout ALTER COLUMN weight SET NOT NULL; +ALTER TABLE sp_action ALTER COLUMN weight SET NOT NULL; +ALTER TABLE sp_target_filter_query ALTER COLUMN auto_assign_weight SET NOT NULL; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_29__add_ds_sm_locked___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_29__add_ds_sm_locked___DB2.sql index 831528f40..c5c0de6fb 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_29__add_ds_sm_locked___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_29__add_ds_sm_locked___DB2.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_base_software_module - ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; -ALTER TABLE sp_distribution_set - ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; \ No newline at end of file +ALTER TABLE sp_base_software_module ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; +ALTER TABLE sp_distribution_set ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_5__baseline___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_5__baseline___DB2.sql index 2657b1a46..274ead21b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_5__baseline___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_5__baseline___DB2.sql @@ -1,500 +1,458 @@ -CREATE TABLE sp_ds_type_element -( - mandatory SMALLINT DEFAULT 0, - distribution_set_type BIGINT NOT NULL, - software_module_type BIGINT NOT NULL, - PRIMARY KEY (distribution_set_type, software_module_type) -); +CREATE TABLE sp_ds_type_element + ( + mandatory SMALLINT DEFAULT 0, + distribution_set_type BIGINT NOT NULL, + software_module_type BIGINT NOT NULL, + PRIMARY KEY (distribution_set_type, software_module_type) + ); -CREATE TABLE sp_action -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - action_type INTEGER NOT NULL, - active SMALLINT DEFAULT 0, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - forced_time BIGINT, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - optlock_revision INTEGER, - status INTEGER NOT NULL, - distribution_set BIGINT NOT NULL, - rollout BIGINT, - rolloutgroup BIGINT, - target BIGINT NOT NULL, - maintenance_cron_schedule VARCHAR(40), - maintenance_duration VARCHAR(40), - maintenance_time_zone VARCHAR(40), - PRIMARY KEY (id) -); +CREATE TABLE sp_action + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + action_type INTEGER NOT NULL, + active SMALLINT DEFAULT 0, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + forced_time BIGINT, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + optlock_revision INTEGER, + status INTEGER NOT NULL, + distribution_set BIGINT NOT NULL, + rollout BIGINT, + rolloutgroup BIGINT, + target BIGINT NOT NULL, + maintenance_cron_schedule VARCHAR(40), + maintenance_duration VARCHAR(40), + maintenance_time_zone VARCHAR(40), + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_action_01 - ON sp_action (tenant, distribution_set); +CREATE INDEX sp_idx_action_01 + ON sp_action (tenant, distribution_set); -CREATE INDEX sp_idx_action_02 - ON sp_action (tenant, target, active); +CREATE INDEX sp_idx_action_02 + ON sp_action (tenant, target, active); -CREATE INDEX sp_idx_action_prim - ON sp_action (tenant, id); +CREATE INDEX sp_idx_action_prim + ON sp_action (tenant, id); -CREATE TABLE sp_action_status -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - target_occurred_at BIGINT NOT NULL, - optlock_revision INTEGER, - status INTEGER NOT NULL, - action BIGINT NOT NULL, - PRIMARY KEY (id) -); +CREATE TABLE sp_action_status + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + target_occurred_at BIGINT NOT NULL, + optlock_revision INTEGER, + status INTEGER NOT NULL, + action BIGINT NOT NULL, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_action_status_02 - ON sp_action_status (tenant, action, status); +CREATE INDEX sp_idx_action_status_02 + ON sp_action_status (tenant, action, status); -CREATE INDEX sp_idx_action_status_prim - ON sp_action_status (tenant, id); +CREATE INDEX sp_idx_action_status_prim + ON sp_action_status (tenant, id); -CREATE TABLE sp_artifact -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - provided_file_name VARCHAR(256), - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - md5_hash VARCHAR(32), - optlock_revision INTEGER, - sha1_hash VARCHAR(40) NOT NULL, - file_size BIGINT, - software_module BIGINT NOT NULL, - PRIMARY KEY (id) -); +CREATE TABLE sp_artifact + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + provided_file_name VARCHAR(256), + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + md5_hash VARCHAR(32), + optlock_revision INTEGER, + sha1_hash VARCHAR(40) NOT NULL, + file_size BIGINT, + software_module BIGINT NOT NULL, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_artifact_01 - ON sp_artifact (tenant, software_module); +CREATE INDEX sp_idx_artifact_01 + ON sp_artifact (tenant, software_module); -CREATE INDEX sp_idx_artifact_02 - ON sp_artifact (tenant, sha1_hash); +CREATE INDEX sp_idx_artifact_02 + ON sp_artifact (tenant, sha1_hash); -CREATE INDEX sp_idx_artifact_prim - ON sp_artifact (tenant, id); +CREATE INDEX sp_idx_artifact_prim + ON sp_artifact (tenant, id); -CREATE TABLE sp_distribution_set -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - complete SMALLINT DEFAULT 0, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted SMALLINT DEFAULT 0, - description VARCHAR(512), - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - required_migration_step SMALLINT DEFAULT 0, - VERSION VARCHAR(64) NOT NULL, - ds_id BIGINT NOT NULL, - PRIMARY KEY (id) -); +CREATE TABLE sp_distribution_set + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + complete SMALLINT DEFAULT 0, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted SMALLINT DEFAULT 0, + description VARCHAR(512), + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + required_migration_step SMALLINT DEFAULT 0, + VERSION VARCHAR(64) NOT NULL, + ds_id BIGINT NOT NULL, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_distribution_set_01 - ON sp_distribution_set (tenant, deleted, complete); +CREATE INDEX sp_idx_distribution_set_01 + ON sp_distribution_set (tenant, deleted, complete); -CREATE INDEX sp_idx_distribution_set_prim - ON sp_distribution_set (tenant, id); +CREATE INDEX sp_idx_distribution_set_prim + ON sp_distribution_set (tenant, id); -CREATE TABLE sp_ds_metadata -( - meta_key VARCHAR(128) NOT NULL, - meta_value VARCHAR(4000), - ds_id BIGINT NOT NULL, - PRIMARY KEY (meta_key, ds_id) -); +CREATE TABLE sp_ds_metadata + ( + meta_key VARCHAR(128) NOT NULL, + meta_value VARCHAR(4000), + ds_id BIGINT NOT NULL, + PRIMARY KEY (meta_key, ds_id) + ); -CREATE TABLE sp_distributionset_tag -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16), - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - description VARCHAR(512), - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - PRIMARY KEY (id) -); +CREATE TABLE sp_distributionset_tag + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16), + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + description VARCHAR(512), + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_distribution_set_tag_prim - ON sp_distributionset_tag (tenant, id); +CREATE INDEX sp_idx_distribution_set_tag_prim + ON sp_distributionset_tag (tenant, id); -CREATE TABLE sp_distribution_set_type -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16), - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted SMALLINT DEFAULT 0, - description VARCHAR(512), - type_key VARCHAR(64) NOT NULL, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - PRIMARY KEY (id) -); +CREATE TABLE sp_distribution_set_type + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16), + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted SMALLINT DEFAULT 0, + description VARCHAR(512), + type_key VARCHAR(64) NOT NULL, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_distribution_set_type_01 - ON sp_distribution_set_type (tenant, deleted); +CREATE INDEX sp_idx_distribution_set_type_01 + ON sp_distribution_set_type (tenant, deleted); -CREATE INDEX sp_idx_distribution_set_type_prim - ON sp_distribution_set_type (tenant, id); +CREATE INDEX sp_idx_distribution_set_type_prim + ON sp_distribution_set_type (tenant, id); -CREATE TABLE sp_rollout -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - action_type INTEGER NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted SMALLINT DEFAULT 0, - description VARCHAR(512), - forced_time BIGINT, - last_check BIGINT, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - rollout_groups_created INTEGER, - start_at BIGINT, - status INTEGER NOT NULL, - target_filter VARCHAR(1024) NOT NULL, - total_targets BIGINT, - distribution_set BIGINT NOT NULL, - PRIMARY KEY (id) -); +CREATE TABLE sp_rollout + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + action_type INTEGER NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted SMALLINT DEFAULT 0, + description VARCHAR(512), + forced_time BIGINT, + last_check BIGINT, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + rollout_groups_created INTEGER, + start_at BIGINT, + status INTEGER NOT NULL, + target_filter VARCHAR(1024) NOT NULL, + total_targets BIGINT, + distribution_set BIGINT NOT NULL, + PRIMARY KEY (id) + ); -CREATE TABLE sp_rolloutgroup -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - description VARCHAR(512), - error_action INTEGER, - error_action_exp VARCHAR(512), - error_condition INTEGER, - error_condition_exp VARCHAR(512), - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - status INTEGER NOT NULL, - success_action INTEGER NOT NULL, - success_action_exp VARCHAR(512), - success_condition INTEGER NOT NULL, - success_condition_exp VARCHAR(512) NOT NULL, - target_filter VARCHAR(1024), - target_percentage FLOAT, - total_targets INTEGER, - parent_id BIGINT, - rollout BIGINT NOT NULL, - PRIMARY KEY (id) -); +CREATE TABLE sp_rolloutgroup + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + description VARCHAR(512), + error_action INTEGER, + error_action_exp VARCHAR(512), + error_condition INTEGER, + error_condition_exp VARCHAR(512), + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + status INTEGER NOT NULL, + success_action INTEGER NOT NULL, + success_action_exp VARCHAR(512), + success_condition INTEGER NOT NULL, + success_condition_exp VARCHAR(512) NOT NULL, + target_filter VARCHAR(1024), + target_percentage FLOAT, + total_targets INTEGER, + parent_id BIGINT, + rollout BIGINT NOT NULL, + PRIMARY KEY (id) + ); -CREATE TABLE sp_base_software_module -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted SMALLINT DEFAULT 0, - description VARCHAR(512), - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - vendor VARCHAR(256), - VERSION VARCHAR(64) NOT NULL, - module_type BIGINT NOT NULL, - PRIMARY KEY (id) -); +CREATE TABLE sp_base_software_module + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted SMALLINT DEFAULT 0, + description VARCHAR(512), + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + vendor VARCHAR(256), + VERSION VARCHAR(64) NOT NULL, + module_type BIGINT NOT NULL, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_base_sw_module_01 - ON sp_base_software_module (tenant, deleted, name, VERSION); +CREATE INDEX sp_idx_base_sw_module_01 + ON sp_base_software_module (tenant, deleted, name, VERSION); -CREATE INDEX sp_idx_base_sw_module_02 - ON sp_base_software_module (tenant, deleted, module_type); +CREATE INDEX sp_idx_base_sw_module_02 + ON sp_base_software_module (tenant, deleted, module_type); -CREATE INDEX sp_idx_base_sw_module_prim - ON sp_base_software_module (tenant, id); +CREATE INDEX sp_idx_base_sw_module_prim + ON sp_base_software_module (tenant, id); -CREATE TABLE sp_sw_metadata -( - meta_key VARCHAR(128) NOT NULL, - target_visible SMALLINT DEFAULT 0, - meta_value VARCHAR(4000), - sw_id BIGINT NOT NULL, - PRIMARY KEY (meta_key, sw_id) -); +CREATE TABLE sp_sw_metadata + ( + meta_key VARCHAR(128) NOT NULL, + target_visible SMALLINT DEFAULT 0, + meta_value VARCHAR(4000), + sw_id BIGINT NOT NULL, + PRIMARY KEY (meta_key, sw_id) + ); -CREATE TABLE sp_software_module_type -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16), - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted SMALLINT DEFAULT 0, - description VARCHAR(512), - type_key VARCHAR(64) NOT NULL, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - max_ds_assignments INTEGER NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - PRIMARY KEY (id) -); +CREATE TABLE sp_software_module_type + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16), + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted SMALLINT DEFAULT 0, + description VARCHAR(512), + type_key VARCHAR(64) NOT NULL, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + max_ds_assignments INTEGER NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_software_module_type_01 - ON sp_software_module_type (tenant, deleted); +CREATE INDEX sp_idx_software_module_type_01 + ON sp_software_module_type (tenant, deleted); -CREATE INDEX sp_idx_software_module_type_prim - ON sp_software_module_type (tenant, id); +CREATE INDEX sp_idx_software_module_type_prim + ON sp_software_module_type (tenant, id); -CREATE TABLE sp_target -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - address VARCHAR(512), - controller_id VARCHAR(64) NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - description VARCHAR(512), - install_date BIGINT, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - last_target_query BIGINT, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - request_controller_attributes SMALLINT DEFAULT 0 NOT NULL, - sec_token VARCHAR(128) NOT NULL, - update_status INTEGER NOT NULL, - assigned_distribution_set BIGINT, - installed_distribution_set BIGINT, - PRIMARY KEY (id) -); +CREATE TABLE sp_target + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + address VARCHAR(512), + controller_id VARCHAR(64) NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + description VARCHAR(512), + install_date BIGINT, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + last_target_query BIGINT, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + request_controller_attributes SMALLINT DEFAULT 0 NOT NULL, + sec_token VARCHAR(128) NOT NULL, + update_status INTEGER NOT NULL, + assigned_distribution_set BIGINT, + installed_distribution_set BIGINT, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_target_01 - ON sp_target (tenant, name, assigned_distribution_set); +CREATE INDEX sp_idx_target_01 + ON sp_target (tenant, name, assigned_distribution_set); -CREATE INDEX sp_idx_target_03 - ON sp_target (tenant, controller_id, assigned_distribution_set); +CREATE INDEX sp_idx_target_03 + ON sp_target (tenant, controller_id, assigned_distribution_set); -CREATE INDEX sp_idx_target_04 - ON sp_target (tenant, created_at); +CREATE INDEX sp_idx_target_04 + ON sp_target (tenant, created_at); -CREATE INDEX sp_idx_target_prim - ON sp_target (tenant, id); +CREATE INDEX sp_idx_target_prim + ON sp_target (tenant, id); -CREATE TABLE sp_target_filter_query -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - QUERY VARCHAR(1024) NOT NULL, - auto_assign_distribution_set BIGINT, - PRIMARY KEY (id) -); +CREATE TABLE sp_target_filter_query + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + QUERY VARCHAR(1024) NOT NULL, + auto_assign_distribution_set BIGINT, + PRIMARY KEY (id) + ); -CREATE TABLE sp_target_tag -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16), - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - description VARCHAR(512), - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER, - PRIMARY KEY (id) -); +CREATE TABLE sp_target_tag + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16), + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + description VARCHAR(512), + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_target_tag_prim - ON sp_target_tag (tenant, id); +CREATE INDEX sp_idx_target_tag_prim + ON sp_target_tag (tenant, id); -CREATE TABLE sp_tenant_configuration -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - conf_key VARCHAR(128) NOT NULL, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - optlock_revision INTEGER, - conf_value VARCHAR(512) NOT NULL, - PRIMARY KEY (id) -); +CREATE TABLE sp_tenant_configuration + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + conf_key VARCHAR(128) NOT NULL, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + optlock_revision INTEGER, + conf_value VARCHAR(512) NOT NULL, + PRIMARY KEY (id) + ); -CREATE TABLE sp_tenant -( - id BIGINT GENERATED always AS IDENTITY NOT NULL, - created_at BIGINT NOT NULL, - created_by VARCHAR(40) NOT NULL, - last_modified_at BIGINT NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - optlock_revision INTEGER, - tenant VARCHAR(40) NOT NULL, - default_ds_type BIGINT NOT NULL, - PRIMARY KEY (id) -); +CREATE TABLE sp_tenant + ( + id BIGINT GENERATED always AS IDENTITY NOT NULL, + created_at BIGINT NOT NULL, + created_by VARCHAR(40) NOT NULL, + last_modified_at BIGINT NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + optlock_revision INTEGER, + tenant VARCHAR(40) NOT NULL, + default_ds_type BIGINT NOT NULL, + PRIMARY KEY (id) + ); -CREATE INDEX sp_idx_tenant_prim - ON sp_tenant (tenant, id); +CREATE INDEX sp_idx_tenant_prim + ON sp_tenant (tenant, id); -CREATE TABLE sp_rollouttargetgroup -( - rolloutgroup_id BIGINT NOT NULL, - target_id BIGINT NOT NULL, - PRIMARY KEY (rolloutgroup_id, target_id) -); +CREATE TABLE sp_rollouttargetgroup + ( + rolloutgroup_id BIGINT NOT NULL, + target_id BIGINT NOT NULL, + PRIMARY KEY (rolloutgroup_id, target_id) + ); -CREATE TABLE sp_action_status_messages -( - action_status_id BIGINT NOT NULL, - detail_message VARCHAR(512) NOT NULL -); +CREATE TABLE sp_action_status_messages + ( + action_status_id BIGINT NOT NULL, + detail_message VARCHAR(512) NOT NULL + ); -CREATE INDEX sp_idx_action_status_msgs_01 - ON sp_action_status_messages (action_status_id); +CREATE INDEX sp_idx_action_status_msgs_01 + ON sp_action_status_messages (action_status_id); -CREATE TABLE sp_ds_module -( - ds_id BIGINT NOT NULL, - module_id BIGINT NOT NULL, - PRIMARY KEY (ds_id, module_id) -); +CREATE TABLE sp_ds_module + ( + ds_id BIGINT NOT NULL, + module_id BIGINT NOT NULL, + PRIMARY KEY (ds_id, module_id) + ); -CREATE TABLE sp_ds_dstag -( - ds BIGINT NOT NULL, - tag BIGINT NOT NULL, - PRIMARY KEY (ds, tag) -); +CREATE TABLE sp_ds_dstag + ( + ds BIGINT NOT NULL, + tag BIGINT NOT NULL, + PRIMARY KEY (ds, tag) + ); -CREATE TABLE sp_target_attributes -( - target_id BIGINT NOT NULL, - attribute_value VARCHAR(128), - attribute_key VARCHAR(32) NOT NULL -); +CREATE TABLE sp_target_attributes + ( + target_id BIGINT NOT NULL, + attribute_value VARCHAR(128), + attribute_key VARCHAR(32) NOT NULL + ); -CREATE TABLE sp_target_target_tag -( - target BIGINT NOT NULL, - tag BIGINT NOT NULL, - PRIMARY KEY (target, tag) -); +CREATE TABLE sp_target_target_tag + ( + target BIGINT NOT NULL, + tag BIGINT NOT NULL, + PRIMARY KEY (target, tag) + ); -ALTER TABLE sp_distribution_set - ADD CONSTRAINT uk_distrib_set UNIQUE (name, version, tenant); -ALTER TABLE sp_distributionset_tag - ADD CONSTRAINT uk_ds_tag UNIQUE (name, tenant); -ALTER TABLE sp_distribution_set_type - ADD CONSTRAINT uk_dst_name UNIQUE (name, tenant); -ALTER TABLE sp_distribution_set_type - ADD CONSTRAINT uk_dst_key UNIQUE (type_key, tenant); -ALTER TABLE sp_rollout - ADD CONSTRAINT uk_rollout UNIQUE (name, tenant); -ALTER TABLE sp_rolloutgroup - ADD CONSTRAINT uk_rolloutgroup UNIQUE (name, rollout, tenant); -ALTER TABLE sp_base_software_module - ADD CONSTRAINT uk_base_sw_mod UNIQUE (module_type, name, version, tenant); -ALTER TABLE sp_software_module_type - ADD CONSTRAINT uk_smt_type_key UNIQUE (type_key, tenant); -ALTER TABLE sp_software_module_type - ADD CONSTRAINT uk_smt_name UNIQUE (name, tenant); -ALTER TABLE sp_target - ADD CONSTRAINT uk_tenant_controller_ UNIQUE (controller_id, tenant); -ALTER TABLE sp_target_filter_query - ADD CONSTRAINT uk_tenant_custom_filt UNIQUE (name, tenant); -ALTER TABLE sp_target_tag - ADD CONSTRAINT uk_targ_tag UNIQUE (name, tenant); -ALTER TABLE sp_tenant_configuration - ADD CONSTRAINT uk_tenant_key UNIQUE (conf_key, tenant); -ALTER TABLE sp_tenant - ADD CONSTRAINT uk_tenantmd_tenant UNIQUE (tenant); +ALTER TABLE sp_distribution_set ADD CONSTRAINT uk_distrib_set UNIQUE (name, version, tenant); +ALTER TABLE sp_distributionset_tag ADD CONSTRAINT uk_ds_tag UNIQUE (name, tenant); +ALTER TABLE sp_distribution_set_type ADD CONSTRAINT uk_dst_name UNIQUE (name, tenant); +ALTER TABLE sp_distribution_set_type ADD CONSTRAINT uk_dst_key UNIQUE (type_key, tenant); +ALTER TABLE sp_rollout ADD CONSTRAINT uk_rollout UNIQUE (name, tenant); +ALTER TABLE sp_rolloutgroup ADD CONSTRAINT uk_rolloutgroup UNIQUE (name, rollout, tenant); +ALTER TABLE sp_base_software_module ADD CONSTRAINT uk_base_sw_mod UNIQUE (module_type, name, version, tenant); +ALTER TABLE sp_software_module_type ADD CONSTRAINT uk_smt_type_key UNIQUE (type_key, tenant); +ALTER TABLE sp_software_module_type ADD CONSTRAINT uk_smt_name UNIQUE (name, tenant); +ALTER TABLE sp_target ADD CONSTRAINT uk_tenant_controller_ UNIQUE (controller_id, tenant); +ALTER TABLE sp_target_filter_query ADD CONSTRAINT uk_tenant_custom_filt UNIQUE (name, tenant); +ALTER TABLE sp_target_tag ADD CONSTRAINT uk_targ_tag UNIQUE (name, tenant); +ALTER TABLE sp_tenant_configuration ADD CONSTRAINT uk_tenant_key UNIQUE (conf_key, tenant); +ALTER TABLE sp_tenant ADD CONSTRAINT uk_tenantmd_tenant UNIQUE (tenant); -ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_element FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_smtype FOREIGN KEY (software_module_type) REFERENCES sp_software_module_type (id) ON DELETE CASCADE; -ALTER TABLE sp_action - ADD CONSTRAINT fk_action_rolloutgroup FOREIGN KEY (rolloutgroup) REFERENCES sp_rolloutgroup (id); -ALTER TABLE sp_action - ADD CONSTRAINT fk_action_rollout FOREIGN KEY (rolloutgroup) REFERENCES sp_rolloutgroup (id); -ALTER TABLE sp_action - ADD CONSTRAINT fk_targ_act_hist_targ FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; -ALTER TABLE sp_action - ADD CONSTRAINT fk_action_ds FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; -ALTER TABLE sp_action_status - ADD CONSTRAINT fk_act_stat_action FOREIGN KEY (action) REFERENCES sp_action (id) ON DELETE CASCADE; -ALTER TABLE sp_artifact - ADD CONSTRAINT fk_assigned_sm FOREIGN KEY (software_module) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; -ALTER TABLE sp_distribution_set - ADD CONSTRAINT fk_ds_dstype_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set_type (id); -ALTER TABLE sp_ds_metadata - ADD CONSTRAINT fk_metadata_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; -ALTER TABLE sp_rollout - ADD CONSTRAINT fk_rollout_ds FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id); -ALTER TABLE sp_rolloutgroup - ADD CONSTRAINT fk_rolloutgroup_rollout FOREIGN KEY (rollout) REFERENCES sp_rollout (id) ON DELETE CASCADE; -ALTER TABLE sp_base_software_module - ADD CONSTRAINT fk_module_type FOREIGN KEY (module_type) REFERENCES sp_software_module_type (id); -ALTER TABLE sp_sw_metadata - ADD CONSTRAINT fk_metadata_sw FOREIGN KEY (sw_id) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; -ALTER TABLE sp_target - ADD CONSTRAINT fk_target_inst_ds FOREIGN KEY (installed_distribution_set) REFERENCES sp_distribution_set (id); -ALTER TABLE sp_target - ADD CONSTRAINT fk_target_assign_ds FOREIGN KEY (assigned_distribution_set) REFERENCES sp_distribution_set (id); -ALTER TABLE sp_target_filter_query - ADD CONSTRAINT fk_filter_auto_assign_ds FOREIGN KEY (auto_assign_distribution_set) REFERENCES sp_distribution_set (id) ON DELETE SET NULL; -ALTER TABLE sp_tenant - ADD CONSTRAINT fk_tenant_md_default_ds_type FOREIGN KEY (default_ds_type) REFERENCES sp_distribution_set_type (id); -ALTER TABLE sp_rollouttargetgroup - ADD CONSTRAINT fk_rollouttargetgroup_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; -ALTER TABLE sp_rollouttargetgroup - ADD CONSTRAINT fk_rollouttargetgroup_group FOREIGN KEY (rolloutGroup_Id) REFERENCES sp_rolloutgroup (id) ON DELETE CASCADE; -ALTER TABLE sp_action_status_messages - ADD CONSTRAINT fk_stat_msg_act_stat FOREIGN KEY (action_status_id) REFERENCES sp_action_status (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_module - ADD CONSTRAINT fk_ds_module_module FOREIGN KEY (module_id) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_module - ADD CONSTRAINT fk_ds_module_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_dstag - ADD CONSTRAINT fk_ds_dstag_tag FOREIGN KEY (tag) REFERENCES sp_distributionset_tag (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_dstag - ADD CONSTRAINT fk_ds_dstag_ds FOREIGN KEY (ds) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; -ALTER TABLE sp_target_attributes - ADD CONSTRAINT fk_targ_attrib_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; -ALTER TABLE sp_target_target_tag - ADD CONSTRAINT fk_targ_targtag_tag FOREIGN KEY (tag) REFERENCES sp_target_tag (id) ON DELETE CASCADE; -ALTER TABLE sp_target_target_tag - ADD CONSTRAINT fk_targ_targtag_target FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_type_element ADD CONSTRAINT fk_ds_type_element_element FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_type_element ADD CONSTRAINT fk_ds_type_element_smtype FOREIGN KEY (software_module_type) REFERENCES sp_software_module_type (id) ON DELETE CASCADE; +ALTER TABLE sp_action ADD CONSTRAINT fk_action_rolloutgroup FOREIGN KEY (rolloutgroup) REFERENCES sp_rolloutgroup (id); +ALTER TABLE sp_action ADD CONSTRAINT fk_action_rollout FOREIGN KEY (rolloutgroup) REFERENCES sp_rolloutgroup (id); +ALTER TABLE sp_action ADD CONSTRAINT fk_targ_act_hist_targ FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_action ADD CONSTRAINT fk_action_ds FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; +ALTER TABLE sp_action_status ADD CONSTRAINT fk_act_stat_action FOREIGN KEY (action) REFERENCES sp_action (id) ON DELETE CASCADE; +ALTER TABLE sp_artifact ADD CONSTRAINT fk_assigned_sm FOREIGN KEY (software_module) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; +ALTER TABLE sp_distribution_set ADD CONSTRAINT fk_ds_dstype_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set_type (id); +ALTER TABLE sp_ds_metadata ADD CONSTRAINT fk_metadata_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; +ALTER TABLE sp_rollout ADD CONSTRAINT fk_rollout_ds FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id); +ALTER TABLE sp_rolloutgroup ADD CONSTRAINT fk_rolloutgroup_rollout FOREIGN KEY (rollout) REFERENCES sp_rollout (id) ON DELETE CASCADE; +ALTER TABLE sp_base_software_module ADD CONSTRAINT fk_module_type FOREIGN KEY (module_type) REFERENCES sp_software_module_type (id); +ALTER TABLE sp_sw_metadata ADD CONSTRAINT fk_metadata_sw FOREIGN KEY (sw_id) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; +ALTER TABLE sp_target ADD CONSTRAINT fk_target_inst_ds FOREIGN KEY (installed_distribution_set) REFERENCES sp_distribution_set (id); +ALTER TABLE sp_target ADD CONSTRAINT fk_target_assign_ds FOREIGN KEY (assigned_distribution_set) REFERENCES sp_distribution_set (id); +ALTER TABLE sp_target_filter_query ADD CONSTRAINT fk_filter_auto_assign_ds FOREIGN KEY (auto_assign_distribution_set) REFERENCES sp_distribution_set (id) ON DELETE SET NULL; +ALTER TABLE sp_tenant ADD CONSTRAINT fk_tenant_md_default_ds_type FOREIGN KEY (default_ds_type) REFERENCES sp_distribution_set_type (id); +ALTER TABLE sp_rollouttargetgroup ADD CONSTRAINT fk_rollouttargetgroup_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_rollouttargetgroup ADD CONSTRAINT fk_rollouttargetgroup_group FOREIGN KEY (rolloutGroup_Id) REFERENCES sp_rolloutgroup (id) ON DELETE CASCADE; +ALTER TABLE sp_action_status_messages ADD CONSTRAINT fk_stat_msg_act_stat FOREIGN KEY (action_status_id) REFERENCES sp_action_status (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_module ADD CONSTRAINT fk_ds_module_module FOREIGN KEY (module_id) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_module ADD CONSTRAINT fk_ds_module_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_dstag ADD CONSTRAINT fk_ds_dstag_tag FOREIGN KEY (tag) REFERENCES sp_distributionset_tag (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_dstag ADD CONSTRAINT fk_ds_dstag_ds FOREIGN KEY (ds) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; +ALTER TABLE sp_target_attributes ADD CONSTRAINT fk_targ_attrib_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_target_target_tag ADD CONSTRAINT fk_targ_targtag_tag FOREIGN KEY (tag) REFERENCES sp_target_tag (id) ON DELETE CASCADE; +ALTER TABLE sp_target_target_tag ADD CONSTRAINT fk_targ_targtag_target FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_6__add_index___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_6__add_index___DB2.sql index 9fdbca2f8..d7d7d6cc7 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_6__add_index___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_6__add_index___DB2.sql @@ -1,2 +1,2 @@ -CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name); +CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name); CREATE INDEX sp_idx_distribution_set_tag_01 ON sp_distributionset_tag (tenant, name); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_7__add_rollout_approval_fields___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_7__add_rollout_approval_fields___DB2.sql index 8c43cf0fb..93824dc9d 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_7__add_rollout_approval_fields___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_7__add_rollout_approval_fields___DB2.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_rollout - ADD COLUMN approval_decided_by varchar(40); -ALTER TABLE sp_rollout - ADD COLUMN approval_remark varchar(255); \ No newline at end of file +ALTER TABLE sp_rollout ADD COLUMN approval_decided_by varchar(40); +ALTER TABLE sp_rollout ADD COLUMN approval_remark varchar(255); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_8__change_length_of_created_last_modified_by___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_8__change_length_of_created_last_modified_by___DB2.sql index edec4a13a..46d0b8f3c 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_8__change_length_of_created_last_modified_by___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_8__change_length_of_created_last_modified_by___DB2.sql @@ -1,76 +1,45 @@ -ALTER TABLE sp_action - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_action - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_action ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_action ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_action_status - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_action_status - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_action_status ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_action_status ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_artifact - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_artifact - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_artifact ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_artifact ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_base_software_module - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_base_software_module - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_base_software_module ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_base_software_module ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_distributionset_tag - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_distributionset_tag - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_distributionset_tag ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_distributionset_tag ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_distribution_set - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_distribution_set - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_distribution_set ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_distribution_set ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_distribution_set_type - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_distribution_set_type - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_distribution_set_type ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_distribution_set_type ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_rollout - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_rollout - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_rollout - ALTER COLUMN approval_decided_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_rollout ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_rollout ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_rollout ALTER COLUMN approval_decided_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_rolloutgroup - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_rolloutgroup - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_rolloutgroup ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_rolloutgroup ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_software_module_type - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_software_module_type - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_software_module_type ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_software_module_type ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_target - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_target - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_target ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_target ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_target_filter_query - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_target_filter_query - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_target_filter_query ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_target_filter_query ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_target_tag - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_target_tag - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_target_tag ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_target_tag ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_tenant - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_tenant - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_tenant ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_tenant ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_tenant_configuration - ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); -ALTER TABLE sp_tenant_configuration - ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); \ No newline at end of file +ALTER TABLE sp_tenant_configuration ALTER COLUMN created_by SET DATA TYPE VARCHAR(64); +ALTER TABLE sp_tenant_configuration ALTER COLUMN last_modified_by SET DATA TYPE VARCHAR(64); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_9__add_target_metadata___DB2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_9__add_target_metadata___DB2.sql index 3d4f6f21d..027af4dd6 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_9__add_target_metadata___DB2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/DB2/V1_12_9__add_target_metadata___DB2.sql @@ -1,10 +1,9 @@ -CREATE TABLE sp_target_metadata -( - meta_key VARCHAR(128) NOT NULL, - meta_value VARCHAR(4000), - target_id BIGINT NOT NULL, - PRIMARY KEY (meta_key, target_id) -); +CREATE TABLE sp_target_metadata +( + meta_key VARCHAR(128) NOT NULL, + meta_value VARCHAR(4000), + target_id BIGINT NOT NULL, + PRIMARY KEY (meta_key, target_id) +); -ALTER TABLE sp_target_metadata - ADD CONSTRAINT fk_metadata_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_target_metadata ADD CONSTRAINT fk_metadata_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_0_1__init___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_0_1__init___H2.sql index 2aa52c6d8..5f022bb3c 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_0_1__init___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_0_1__init___H2.sql @@ -1,516 +1,494 @@ -create table sp_action -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - action_type varchar(255) not null, - active boolean, - forced_time bigint, - status integer, - distribution_set bigint, - target bigint, - primary key (id) -); - -create table sp_action_status -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - target_occurred_at bigint, - status integer, - action bigint not null, - primary key (id) -); - -create table sp_action_status_messages -( - action_status_id bigint not null, - detail_message varchar(512) -); - -create table sp_artifact -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - md5_hash varchar(32), - sha1_hash varchar(40), - file_size bigint, - provided_file_name varchar(256), - gridfs_file_name varchar(40), - software_module bigint not null, - primary key (id) -); - -create table sp_base_software_module -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - version varchar(64) not null, - deleted boolean, - vendor varchar(256), - module_type bigint not null, - primary key (id) -); - -create table sp_distribution_set -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - version varchar(64) not null, - complete boolean, - deleted boolean, - required_migration_step boolean, - ds_id bigint not null, - primary key (id) -); - -create table sp_distribution_set_type -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - colour varchar(16), - deleted boolean, - type_key varchar(64) not null, - primary key (id) -); - -create table sp_distributionset_tag -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - colour varchar(16), - primary key (id) -); - -create table sp_ds_dstag -( - ds bigint not null, - TAG bigint not null, - primary key (ds, TAG) -); - -create table sp_ds_metadata -( - meta_key varchar(128) not null, - meta_value varchar(4000), - ds_id bigint not null, - primary key (ds_id, meta_key) -); - -create table sp_ds_module -( - ds_id bigint not null, - module_id bigint not null, - primary key (ds_id, module_id) -); - -create table sp_ds_type_element -( - mandatory boolean, - distribution_set_type bigint not null, - software_module_type bigint not null, - primary key (distribution_set_type, software_module_type) -); - -create table sp_external_artifact -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - md5_hash varchar(32), - sha1_hash varchar(40), - file_size bigint, - url_suffix varchar(512), - provider bigint not null, - software_module bigint not null, - primary key (id) -); - -create table sp_external_provider -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - base_url varchar(512) not null, - default_url_suffix varchar(512), - primary key (id) -); - -create table sp_software_module_type -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - colour varchar(16), - deleted boolean, - type_key varchar(64) not null, - max_ds_assignments integer not null, - primary key (id) -); - -create table sp_sw_metadata -( - meta_key varchar(128) not null, - meta_value varchar(4000), - sw_id bigint not null, - primary key (meta_key, sw_id) -); - -create table sp_target -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - controller_id varchar(64), - sec_token varchar(128) not null, - assigned_distribution_set bigint, - primary key (id) -); - -create table sp_target_attributes -( - target_id bigint not null, - attribute_value varchar(128), - attribute_key varchar(32) not null, - primary key (target_id, attribute_key) -); - -create table sp_target_info -( - target_id bigint not null, - install_date bigint, - ip_address varchar(46), - last_target_query bigint, - request_controller_attributes boolean not null, - update_status varchar(255) not null, - installed_distribution_set bigint, - primary key (target_id) -); - -create table sp_target_tag -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - colour varchar(16), - primary key (id) -); - -create table sp_target_target_tag -( - target bigint not null, - tag bigint not null, - primary key (target, tag) -); - -create table sp_tenant -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - default_ds_type bigint not null, - primary key (id) -); - -create table sp_tenant_configuration -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - conf_key varchar(128), - conf_value varchar(512), - primary key (id) -); -create index sp_idx_action_01 on sp_action (tenant, distribution_set); + create table sp_action ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + action_type varchar(255) not null, + active boolean, + forced_time bigint, + status integer, + distribution_set bigint, + target bigint, + primary key (id) + ); + + create table sp_action_status ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + target_occurred_at bigint, + status integer, + action bigint not null, + primary key (id) + ); + + create table sp_action_status_messages ( + action_status_id bigint not null, + detail_message varchar(512) + ); + + create table sp_artifact ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + md5_hash varchar(32), + sha1_hash varchar(40), + file_size bigint, + provided_file_name varchar(256), + gridfs_file_name varchar(40), + software_module bigint not null, + primary key (id) + ); + + create table sp_base_software_module ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + version varchar(64) not null, + deleted boolean, + vendor varchar(256), + module_type bigint not null, + primary key (id) + ); + + create table sp_distribution_set ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + version varchar(64) not null, + complete boolean, + deleted boolean, + required_migration_step boolean, + ds_id bigint not null, + primary key (id) + ); + + create table sp_distribution_set_type ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + colour varchar(16), + deleted boolean, + type_key varchar(64) not null, + primary key (id) + ); + + create table sp_distributionset_tag ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + colour varchar(16), + primary key (id) + ); + + create table sp_ds_dstag ( + ds bigint not null, + TAG bigint not null, + primary key (ds, TAG) + ); + + create table sp_ds_metadata ( + meta_key varchar(128) not null, + meta_value varchar(4000), + ds_id bigint not null, + primary key (ds_id, meta_key) + ); + + create table sp_ds_module ( + ds_id bigint not null, + module_id bigint not null, + primary key (ds_id, module_id) + ); + + create table sp_ds_type_element ( + mandatory boolean, + distribution_set_type bigint not null, + software_module_type bigint not null, + primary key (distribution_set_type, software_module_type) + ); + + create table sp_external_artifact ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + md5_hash varchar(32), + sha1_hash varchar(40), + file_size bigint, + url_suffix varchar(512), + provider bigint not null, + software_module bigint not null, + primary key (id) + ); + + create table sp_external_provider ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + base_url varchar(512) not null, + default_url_suffix varchar(512), + primary key (id) + ); + + create table sp_software_module_type ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + colour varchar(16), + deleted boolean, + type_key varchar(64) not null, + max_ds_assignments integer not null, + primary key (id) + ); + + create table sp_sw_metadata ( + meta_key varchar(128) not null, + meta_value varchar(4000), + sw_id bigint not null, + primary key (meta_key, sw_id) + ); + + create table sp_target ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + controller_id varchar(64), + sec_token varchar(128) not null, + assigned_distribution_set bigint, + primary key (id) + ); + + create table sp_target_attributes ( + target_id bigint not null, + attribute_value varchar(128), + attribute_key varchar(32) not null, + primary key (target_id, attribute_key) + ); + + create table sp_target_info ( + target_id bigint not null, + install_date bigint, + ip_address varchar(46), + last_target_query bigint, + request_controller_attributes boolean not null, + update_status varchar(255) not null, + installed_distribution_set bigint, + primary key (target_id) + ); + + create table sp_target_tag ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + colour varchar(16), + primary key (id) + ); + + create table sp_target_target_tag ( + target bigint not null, + tag bigint not null, + primary key (target, tag) + ); + + create table sp_tenant ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + default_ds_type bigint not null, + primary key (id) + ); + + create table sp_tenant_configuration ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + conf_key varchar(128), + conf_value varchar(512), + primary key (id) + ); -create index sp_idx_action_02 on sp_action (tenant, target, active); + create index sp_idx_action_01 on sp_action (tenant, distribution_set); -create index sp_idx_action_prim on sp_action (tenant, id); + create index sp_idx_action_02 on sp_action (tenant, target, active); -create index sp_idx_action_status_01 on sp_action_status (tenant, action); + create index sp_idx_action_prim on sp_action (tenant, id); -create index sp_idx_action_status_02 on sp_action_status (tenant, action, status); + create index sp_idx_action_status_01 on sp_action_status (tenant, action); -create index sp_idx_action_status_prim on sp_action_status (tenant, id); + create index sp_idx_action_status_02 on sp_action_status (tenant, action, status); -create index sp_idx_action_status_msgs_01 on sp_action_status_messages (action_status_id); + create index sp_idx_action_status_prim on sp_action_status (tenant, id); -create index sp_idx_artifact_01 on sp_artifact (tenant, software_module); + create index sp_idx_action_status_msgs_01 on sp_action_status_messages (action_status_id); -create index sp_idx_artifact_prim on sp_artifact (tenant, id); + create index sp_idx_artifact_01 on sp_artifact (tenant, software_module); -alter table sp_base_software_module - add constraint uk_base_sw_mod unique (module_type, name, version, tenant); + create index sp_idx_artifact_prim on sp_artifact (tenant, id); -create index sp_idx_base_sw_module_01 on sp_base_software_module (tenant, deleted, name, version); + alter table sp_base_software_module + add constraint uk_base_sw_mod unique (module_type, name, version, tenant); -create index sp_idx_base_sw_module_02 on sp_base_software_module (tenant, deleted, module_type); + create index sp_idx_base_sw_module_01 on sp_base_software_module (tenant, deleted, name, version); -create index sp_idx_base_sw_module_prim on sp_base_software_module (tenant, id); + create index sp_idx_base_sw_module_02 on sp_base_software_module (tenant, deleted, module_type); -alter table sp_distribution_set - add constraint uk_distrib_set unique (name, version, tenant); + create index sp_idx_base_sw_module_prim on sp_base_software_module (tenant, id); -create index sp_idx_distribution_set_01 on sp_distribution_set (tenant, deleted, name, complete); + alter table sp_distribution_set + add constraint uk_distrib_set unique (name, version, tenant); -create index sp_idx_distribution_set_02 on sp_distribution_set (tenant, required_migration_step); + create index sp_idx_distribution_set_01 on sp_distribution_set (tenant, deleted, name, complete); -create index sp_idx_distribution_set_prim on sp_distribution_set (tenant, id); + create index sp_idx_distribution_set_02 on sp_distribution_set (tenant, required_migration_step); -alter table sp_distribution_set_type - add constraint uk_dst_name unique (name, tenant); + create index sp_idx_distribution_set_prim on sp_distribution_set (tenant, id); -alter table sp_distribution_set_type - add constraint uk_dst_key unique (type_key, tenant); + alter table sp_distribution_set_type + add constraint uk_dst_name unique (name, tenant); -create index sp_idx_distribution_set_type_01 on sp_distribution_set_type (tenant, deleted); + alter table sp_distribution_set_type + add constraint uk_dst_key unique (type_key, tenant); -create index sp_idx_distribution_set_type_prim on sp_distribution_set_type (tenant, id); + create index sp_idx_distribution_set_type_01 on sp_distribution_set_type (tenant, deleted); -alter table sp_distributionset_tag - add constraint uk_ds_tag unique (name, tenant); + create index sp_idx_distribution_set_type_prim on sp_distribution_set_type (tenant, id); -create index sp_idx_distribution_set_tag_prim on sp_distributionset_tag (tenant, id); + alter table sp_distributionset_tag + add constraint uk_ds_tag unique (name, tenant); -create index sp_idx_external_artifact_prim on sp_external_artifact (id, tenant); + create index sp_idx_distribution_set_tag_prim on sp_distributionset_tag (tenant, id); -create index sp_idx_external_provider_prim on sp_external_provider (tenant, id); + create index sp_idx_external_artifact_prim on sp_external_artifact (id, tenant); -alter table sp_software_module_type - add constraint uk_smt_type_key unique (type_key, tenant); + create index sp_idx_external_provider_prim on sp_external_provider (tenant, id); -alter table sp_software_module_type - add constraint uk_smt_name unique (name, tenant); + alter table sp_software_module_type + add constraint uk_smt_type_key unique (type_key, tenant); -create index sp_idx_software_module_type_01 on sp_software_module_type (tenant, deleted); + alter table sp_software_module_type + add constraint uk_smt_name unique (name, tenant); -create index sp_idx_software_module_type_prim on sp_software_module_type (tenant, id); + create index sp_idx_software_module_type_01 on sp_software_module_type (tenant, deleted); -alter table sp_target - add constraint uk_tenant_controller_id unique (controller_id, tenant); + create index sp_idx_software_module_type_prim on sp_software_module_type (tenant, id); -create index sp_idx_target_01 on sp_target (tenant, name, assigned_distribution_set); + alter table sp_target + add constraint uk_tenant_controller_id unique (controller_id, tenant); -create index sp_idx_target_02 on sp_target (tenant, name); + create index sp_idx_target_01 on sp_target (tenant, name, assigned_distribution_set); -create index sp_idx_target_03 on sp_target (tenant, controller_id, assigned_distribution_set); + create index sp_idx_target_02 on sp_target (tenant, name); -create index sp_idx_target_04 on sp_target (tenant, created_at); + create index sp_idx_target_03 on sp_target (tenant, controller_id, assigned_distribution_set); + + create index sp_idx_target_04 on sp_target (tenant, created_at); -create index sp_idx_target_prim on sp_target (tenant, id); + create index sp_idx_target_prim on sp_target (tenant, id); -create index sp_idx_target_info_01 on sp_target_info (ip_address); + create index sp_idx_target_info_01 on sp_target_info (ip_address); -create index sp_idx_target_info_02 on sp_target_info (target_id, update_status); + create index sp_idx_target_info_02 on sp_target_info (target_id, update_status); -alter table sp_target_tag - add constraint uk_targ_tag unique (name, tenant); + alter table sp_target_tag + add constraint uk_targ_tag unique (name, tenant); -create index sp_idx_target_tag_prim on sp_target_tag (tenant, id); + create index sp_idx_target_tag_prim on sp_target_tag (tenant, id); -alter table sp_tenant - add constraint uk_tenantmd_tenant unique (tenant); + alter table sp_tenant + add constraint uk_tenantmd_tenant unique (tenant); -create index sp_idx_tenant_prim on sp_tenant (tenant, id); + create index sp_idx_tenant_prim on sp_tenant (tenant, id); -alter table sp_tenant_configuration - add constraint uk_tenant_key unique (conf_key, tenant); + alter table sp_tenant_configuration + add constraint uk_tenant_key unique (conf_key, tenant); -alter table sp_action - add constraint fk_action_ds - foreign key (distribution_set) - references sp_distribution_set; + alter table sp_action + add constraint fk_action_ds + foreign key (distribution_set) + references sp_distribution_set; -alter table sp_action - add constraint fk_targ_act_hist_targ - foreign key (target) - references sp_target; + alter table sp_action + add constraint fk_targ_act_hist_targ + foreign key (target) + references sp_target; -alter table sp_action_status - add constraint fk_act_stat_action - foreign key (action) - references sp_action; + alter table sp_action_status + add constraint fk_act_stat_action + foreign key (action) + references sp_action; -alter table sp_action_status_messages - add constraint fk_stat_msg_act_stat - foreign key (action_status_id) - references sp_action_status; + alter table sp_action_status_messages + add constraint fk_stat_msg_act_stat + foreign key (action_status_id) + references sp_action_status; -alter table sp_artifact - add constraint fk_assigned_sm - foreign key (software_module) - references sp_base_software_module; + alter table sp_artifact + add constraint fk_assigned_sm + foreign key (software_module) + references sp_base_software_module; -alter table sp_base_software_module - add constraint fk_module_type - foreign key (module_type) - references sp_software_module_type; + alter table sp_base_software_module + add constraint fk_module_type + foreign key (module_type) + references sp_software_module_type; -alter table sp_distribution_set - add constraint fk_ds_dstype_ds - foreign key (ds_id) - references sp_distribution_set_type; + alter table sp_distribution_set + add constraint fk_ds_dstype_ds + foreign key (ds_id) + references sp_distribution_set_type; -alter table sp_ds_dstag - add constraint fk_ds_dstag_tag - foreign key (TAG) - references sp_distributionset_tag; + alter table sp_ds_dstag + add constraint fk_ds_dstag_tag + foreign key (TAG) + references sp_distributionset_tag; -alter table sp_ds_dstag - add constraint fk_ds_dstag_ds - foreign key (ds) - references sp_distribution_set; + alter table sp_ds_dstag + add constraint fk_ds_dstag_ds + foreign key (ds) + references sp_distribution_set; -alter table sp_ds_metadata - add constraint fk_metadata_ds - foreign key (ds_id) - references sp_distribution_set; + alter table sp_ds_metadata + add constraint fk_metadata_ds + foreign key (ds_id) + references sp_distribution_set; -alter table sp_ds_module - add constraint fk_ds_module_module - foreign key (module_id) - references sp_base_software_module; + alter table sp_ds_module + add constraint fk_ds_module_module + foreign key (module_id) + references sp_base_software_module; -alter table sp_ds_module - add constraint fk_ds_module_ds - foreign key (ds_id) - references sp_distribution_set; + alter table sp_ds_module + add constraint fk_ds_module_ds + foreign key (ds_id) + references sp_distribution_set; -alter table sp_ds_type_element - add constraint fk_ds_type_element_element - foreign key (distribution_set_type) - references sp_distribution_set_type; + alter table sp_ds_type_element + add constraint fk_ds_type_element_element + foreign key (distribution_set_type) + references sp_distribution_set_type; -alter table sp_ds_type_element - add constraint fk_ds_type_element_smtype - foreign key (software_module_type) - references sp_software_module_type; - -alter table sp_external_artifact - add constraint fk_art_to_ext_provider - foreign key (provider) - references sp_external_provider; - -alter table sp_external_artifact - add constraint fk_external_assigned_sm - foreign key (software_module) - references sp_base_software_module; - -alter table sp_sw_metadata - add constraint fk_metadata_sw - foreign key (sw_id) - references sp_base_software_module; - -alter table sp_target - add constraint fk_target_assign_ds - foreign key (assigned_distribution_set) - references sp_distribution_set; - -alter table sp_target_attributes - add constraint fk_targ_attrib_target - foreign key (target_id) - references sp_target_info; - -alter table sp_target_info - add constraint fk_target_inst_ds - foreign key (installed_distribution_set) - references sp_distribution_set; - -alter table sp_target_info - add constraint fk_targ_stat_targ - foreign key (target_id) - references sp_target; - -alter table sp_target_target_tag - add constraint fk_targ_targtag_tag - foreign key (tag) - references sp_target_tag; - -alter table sp_target_target_tag - add constraint fk_targ_targtag_target - foreign key (target) - references sp_target; - -alter table sp_tenant - add constraint fk_tenant_md_default_ds_type - foreign key (default_ds_type) - references sp_distribution_set_type; + alter table sp_ds_type_element + add constraint fk_ds_type_element_smtype + foreign key (software_module_type) + references sp_software_module_type; + + alter table sp_external_artifact + add constraint fk_art_to_ext_provider + foreign key (provider) + references sp_external_provider; + + alter table sp_external_artifact + add constraint fk_external_assigned_sm + foreign key (software_module) + references sp_base_software_module; + + alter table sp_sw_metadata + add constraint fk_metadata_sw + foreign key (sw_id) + references sp_base_software_module; + + alter table sp_target + add constraint fk_target_assign_ds + foreign key (assigned_distribution_set) + references sp_distribution_set; + + alter table sp_target_attributes + add constraint fk_targ_attrib_target + foreign key (target_id) + references sp_target_info; + + alter table sp_target_info + add constraint fk_target_inst_ds + foreign key (installed_distribution_set) + references sp_distribution_set; + + alter table sp_target_info + add constraint fk_targ_stat_targ + foreign key (target_id) + references sp_target; + + alter table sp_target_target_tag + add constraint fk_targ_targtag_tag + foreign key (tag) + references sp_target_tag; + + alter table sp_target_target_tag + add constraint fk_targ_targtag_target + foreign key (target) + references sp_target; + + alter table sp_tenant + add constraint fk_tenant_md_default_ds_type + foreign key (default_ds_type) + references sp_distribution_set_type; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_0__advanced_rolloutgroup__H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_0__advanced_rolloutgroup__H2.sql index 27c73472e..7c4954ad8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_0__advanced_rolloutgroup__H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_0__advanced_rolloutgroup__H2.sql @@ -1,4 +1,4 @@ ALTER TABLE sp_rolloutgroup - ADD COLUMN target_percentage FLOAT; + ADD COLUMN target_percentage FLOAT; ALTER TABLE sp_rolloutgroup - ADD COLUMN target_filter VARCHAR(1024); + ADD COLUMN target_filter VARCHAR (1024); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_2__rollout_auto_start__H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_2__rollout_auto_start__H2.sql index 14f2a7abb..e946026f3 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_2__rollout_auto_start__H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_2__rollout_auto_start__H2.sql @@ -1,2 +1,2 @@ ALTER TABLE sp_rollout - ADD COLUMN start_at BIGINT; + ADD COLUMN start_at BIGINT; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_3__add_rollout_deleted_flag__H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_3__add_rollout_deleted_flag__H2.sql index 51b036496..cdfafc74f 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_3__add_rollout_deleted_flag__H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_10_3__add_rollout_deleted_flag__H2.sql @@ -1,8 +1,6 @@ -ALTER TABLE sp_rollout - ADD COLUMN deleted BOOLEAN; +ALTER TABLE sp_rollout ADD COLUMN deleted BOOLEAN; -UPDATE sp_rollout -SET deleted = 0; +UPDATE sp_rollout SET deleted = 0; ALTER TABLE sp_action ALTER target BIGINT NOT NULL; ALTER TABLE sp_action ALTER distribution_set BIGINT NOT NULL; @@ -13,16 +11,16 @@ ALTER TABLE sp_rollout ALTER distribution_set BIGINT NOT NULL; ALTER TABLE sp_rolloutgroup ALTER rollout BIGINT NOT NULL; ALTER TABLE sp_rolloutgroup ALTER status INTEGER NOT NULL; -ALTER TABLE sp_ds_type_element DROP CONSTRAINT fk_ds_type_element_element; -ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_element - FOREIGN KEY (distribution_set_type) - REFERENCES sp_distribution_set_type (id) - ON DELETE CASCADE; +ALTER TABLE sp_ds_type_element DROP CONSTRAINT fk_ds_type_element_element; +ALTER TABLE sp_ds_type_element + ADD CONSTRAINT fk_ds_type_element_element + FOREIGN KEY (distribution_set_type) + REFERENCES sp_distribution_set_type (id) + ON DELETE CASCADE; -ALTER TABLE sp_ds_type_element DROP CONSTRAINT fk_ds_type_element_smtype; -ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_smtype - FOREIGN KEY (software_module_type) - REFERENCES sp_software_module_type (id) - ON DELETE CASCADE; +ALTER TABLE sp_ds_type_element DROP CONSTRAINT fk_ds_type_element_smtype; +ALTER TABLE sp_ds_type_element + ADD CONSTRAINT fk_ds_type_element_smtype + FOREIGN KEY (software_module_type) + REFERENCES sp_software_module_type (id) + ON DELETE CASCADE; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_0__drop_target_info__H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_0__drop_target_info__H2.sql index 343b9f5b3..beddebc02 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_0__drop_target_info__H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_0__drop_target_info__H2.sql @@ -1,43 +1,29 @@ -ALTER TABLE sp_target - ADD COLUMN install_date bigint; -ALTER TABLE sp_target - ADD COLUMN address varchar(512); -ALTER TABLE sp_target - ADD COLUMN last_target_query bigint; -ALTER TABLE sp_target - ADD COLUMN request_controller_attributes bit not null; -ALTER TABLE sp_target - ADD COLUMN update_status varchar(16) not null; -ALTER TABLE sp_target - ADD COLUMN installed_distribution_set bigint; - -UPDATE sp_target t -SET install_date=(SELECT i.install_date FROM sp_target_info i WHERE t.id = i.target_id); -UPDATE sp_target t -SET address=(SELECT i.address FROM sp_target_info i WHERE t.id = i.target_id); -UPDATE sp_target t -SET last_target_query=(SELECT i.last_target_query FROM sp_target_info i WHERE t.id = i.target_id); -UPDATE sp_target t -SET request_controller_attributes=(SELECT i.request_controller_attributes - FROM sp_target_info i - WHERE t.id = i.target_id); -UPDATE sp_target t -SET update_status=(SELECT i.update_status FROM sp_target_info i WHERE t.id = i.target_id); -UPDATE sp_target t -SET installed_distribution_set=(SELECT i.installed_distribution_set FROM sp_target_info i WHERE t.id = i.target_id); +ALTER TABLE sp_target ADD COLUMN install_date bigint; +ALTER TABLE sp_target ADD COLUMN address varchar(512); +ALTER TABLE sp_target ADD COLUMN last_target_query bigint; +ALTER TABLE sp_target ADD COLUMN request_controller_attributes bit not null; +ALTER TABLE sp_target ADD COLUMN update_status varchar(16) not null; +ALTER TABLE sp_target ADD COLUMN installed_distribution_set bigint; + +UPDATE sp_target t SET install_date=(SELECT i.install_date FROM sp_target_info i WHERE t.id = i.target_id); +UPDATE sp_target t SET address=(SELECT i.address FROM sp_target_info i WHERE t.id = i.target_id); +UPDATE sp_target t SET last_target_query=(SELECT i.last_target_query FROM sp_target_info i WHERE t.id = i.target_id); +UPDATE sp_target t SET request_controller_attributes=(SELECT i.request_controller_attributes FROM sp_target_info i WHERE t.id = i.target_id); +UPDATE sp_target t SET update_status=(SELECT i.update_status FROM sp_target_info i WHERE t.id = i.target_id); +UPDATE sp_target t SET installed_distribution_set=(SELECT i.installed_distribution_set FROM sp_target_info i WHERE t.id = i.target_id); ALTER TABLE sp_target_attributes DROP CONSTRAINT fk_targ_attrib_target; -ALTER TABLE sp_target_attributes - ADD CONSTRAINT fk_targ_attrib_target - FOREIGN KEY (target_id) - REFERENCES sp_target (id) - ON DELETE cascade; +ALTER TABLE sp_target_attributes + ADD CONSTRAINT fk_targ_attrib_target + FOREIGN KEY (target_id) + REFERENCES sp_target (id) + ON DELETE cascade; -ALTER TABLE sp_target_info DROP CONSTRAINT fk_target_inst_ds; -ALTER TABLE sp_target - ADD CONSTRAINT fk_target_inst_ds - FOREIGN KEY (installed_distribution_set) - REFERENCES sp_distribution_set (id); +ALTER TABLE sp_target_info DROP CONSTRAINT fk_target_inst_ds; +ALTER TABLE sp_target + ADD CONSTRAINT fk_target_inst_ds + FOREIGN KEY (installed_distribution_set) + REFERENCES sp_distribution_set (id); ALTER TABLE sp_target_info DROP CONSTRAINT fk_targ_stat_targ; DROP INDEX sp_idx_target_info_02; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_1__target_filter_query_UQ___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_1__target_filter_query_UQ___H2.sql index fc1f615ba..f494313a8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_1__target_filter_query_UQ___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_1__target_filter_query_UQ___H2.sql @@ -1,2 +1,2 @@ -alter table sp_target_filter_query - add constraint uk_tenant_custom_filter_name unique (name, tenant); + alter table sp_target_filter_query + add constraint uk_tenant_custom_filter_name unique (name, tenant); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_3__add_module_md_targetvis__H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_3__add_module_md_targetvis__H2.sql index 1fc2a237d..2d5dfc8c4 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_3__add_module_md_targetvis__H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_11_3__add_module_md_targetvis__H2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_sw_metadata - ADD COLUMN target_visible boolean; \ No newline at end of file +ALTER TABLE sp_sw_metadata ADD COLUMN target_visible boolean; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_0__action_performance___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_0__action_performance___H2.sql index ee5c2d694..02b4199c9 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_0__action_performance___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_0__action_performance___H2.sql @@ -1,34 +1,25 @@ -ALTER TABLE sp_action - ADD COLUMN action_type_new integer not null; -UPDATE sp_action -SET action_type_new = - CASE - WHEN (action_type = 'SOFT') THEN 1 - WHEN (action_type = 'TIMEFORCED') THEN 2 - ELSE 0 END; +ALTER TABLE sp_action ADD COLUMN action_type_new integer not null; +UPDATE sp_action SET action_type_new = +CASE WHEN (action_type = 'SOFT') THEN 1 + WHEN (action_type = 'TIMEFORCED') THEN 2 + ELSE 0 END; ALTER TABLE sp_action DROP COLUMN action_type; ALTER TABLE sp_action ALTER COLUMN action_type_new RENAME TO action_type; -ALTER TABLE sp_rollout - ADD COLUMN action_type_new integer not null; -UPDATE sp_rollout -SET action_type_new = - CASE - WHEN (action_type = 'SOFT') THEN 1 - WHEN (action_type = 'TIMEFORCED') THEN 2 - ELSE 0 END; +ALTER TABLE sp_rollout ADD COLUMN action_type_new integer not null; +UPDATE sp_rollout SET action_type_new = +CASE WHEN (action_type = 'SOFT') THEN 1 + WHEN (action_type = 'TIMEFORCED') THEN 2 + ELSE 0 END; ALTER TABLE sp_rollout DROP COLUMN action_type; ALTER TABLE sp_rollout ALTER COLUMN action_type_new RENAME to action_type; -ALTER TABLE sp_target - ADD COLUMN update_status_new integer not null; -UPDATE sp_target -SET update_status_new = - CASE - WHEN (update_status = 'IN_SYNC') THEN 1 - WHEN (update_status = 'PENDING') THEN 2 - WHEN (update_status = 'ERROR') THEN 3 - WHEN (update_status = 'REGISTERED') THEN 4 - ELSE 0 END; +ALTER TABLE sp_target ADD COLUMN update_status_new integer not null; +UPDATE sp_target SET update_status_new = +CASE WHEN (update_status = 'IN_SYNC') THEN 1 + WHEN (update_status = 'PENDING') THEN 2 + WHEN (update_status = 'ERROR') THEN 3 + WHEN (update_status = 'REGISTERED') THEN 4 + ELSE 0 END; ALTER TABLE sp_target DROP COLUMN update_status; ALTER TABLE sp_target ALTER COLUMN update_status_new RENAME TO update_status; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_11__add_auto_assign_action_type___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_11__add_auto_assign_action_type___H2.sql index ee00de0e6..16cb03ef2 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_11__add_auto_assign_action_type___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_11__add_auto_assign_action_type___H2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_target_filter_query - ADD COLUMN auto_assign_action_type integer; \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_action_type integer; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_13__add_action_external_id___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_13__add_action_external_id___H2.sql index 2556b7d21..8dbda293f 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_13__add_action_external_id___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_13__add_action_external_id___H2.sql @@ -1,5 +1,4 @@ -ALTER TABLE sp_action - ADD COLUMN external_ref VARCHAR(512); +ALTER TABLE sp_action ADD COLUMN external_ref VARCHAR(512); CREATE INDEX sp_idx_action_external_ref ON sp_action (external_ref); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_14__add_sha256_hash___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_14__add_sha256_hash___H2.sql index bfe56f337..ca7e53fce 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_14__add_sha256_hash___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_14__add_sha256_hash___H2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_artifact - ADD COLUMN sha256_hash CHAR(64); \ No newline at end of file +ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_15__add_weight___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_15__add_weight___H2.sql index 12db78a80..9eaad20e1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_15__add_weight___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_15__add_weight___H2.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_action - ADD weight INT; -ALTER TABLE sp_rollout - ADD weight INT; -ALTER TABLE sp_target_filter_query - ADD auto_assign_weight INT; +ALTER TABLE sp_action ADD weight INT; +ALTER TABLE sp_rollout ADD weight INT; +ALTER TABLE sp_target_filter_query ADD auto_assign_weight INT; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_16__add_action_initiated_by___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_16__add_action_initiated_by___H2.sql index 9461e26a2..d0b559b61 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_16__add_action_initiated_by___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_16__add_action_initiated_by___H2.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_action - ADD COLUMN initiated_by VARCHAR(64) NOT NULL; -ALTER TABLE sp_target_filter_query - ADD COLUMN auto_assign_initiated_by VARCHAR(64); +ALTER TABLE sp_action ADD COLUMN initiated_by VARCHAR(64) NOT NULL; +ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_initiated_by VARCHAR(64); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_19__add_valid_flag_to_ds___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_19__add_valid_flag_to_ds___H2.sql index 352419711..3ab0e7502 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_19__add_valid_flag_to_ds___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_19__add_valid_flag_to_ds___H2.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_distribution_set - ADD COLUMN valid BOOLEAN; +ALTER TABLE sp_distribution_set ADD COLUMN valid BOOLEAN; -UPDATE sp_distribution_set -SET valid = 1; \ No newline at end of file +UPDATE sp_distribution_set SET valid = 1; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_20__add_encryption_flag_to_sm___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_20__add_encryption_flag_to_sm___H2.sql index 5dd518204..9249d14a1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_20__add_encryption_flag_to_sm___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_20__add_encryption_flag_to_sm___H2.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_base_software_module - ADD COLUMN encrypted BOOLEAN; +ALTER TABLE sp_base_software_module ADD COLUMN encrypted BOOLEAN; -UPDATE sp_base_software_module -SET encrypted = 0; \ No newline at end of file +UPDATE sp_base_software_module SET encrypted = 0; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_23__add_action_status_code___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_23__add_action_status_code___H2.sql index 7bc7abb4d..2e4caf07a 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_23__add_action_status_code___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_23__add_action_status_code___H2.sql @@ -1,3 +1,2 @@ -ALTER TABLE sp_action_status - ADD column code integer; +ALTER TABLE sp_action_status ADD column code integer; CREATE INDEX sp_idx_action_status_03 ON sp_action_status (tenant, code); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_24__add_last_action_status_code___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_24__add_last_action_status_code___H2.sql index 4369c67e8..f92ba4675 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_24__add_last_action_status_code___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_24__add_last_action_status_code___H2.sql @@ -1,2 +1 @@ -ALTER TABLE sp_action - ADD column last_action_status_code integer; \ No newline at end of file +ALTER TABLE sp_action ADD column last_action_status_code integer; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_25__add_confirmation_flag___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_25__add_confirmation_flag___H2.sql index db9683d21..8249c85d4 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_25__add_confirmation_flag___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_25__add_confirmation_flag___H2.sql @@ -1,25 +1,21 @@ -ALTER TABLE sp_rolloutgroup - ADD column confirmation_required BOOLEAN; -UPDATE sp_rolloutgroup -SET confirmation_required = 0; +ALTER TABLE sp_rolloutgroup ADD column confirmation_required BOOLEAN; +UPDATE sp_rolloutgroup SET confirmation_required = 0; -ALTER TABLE sp_target_filter_query - ADD column confirmation_required BOOLEAN; -UPDATE sp_target_filter_query -SET confirmation_required = 0; +ALTER TABLE sp_target_filter_query ADD column confirmation_required BOOLEAN; +UPDATE sp_target_filter_query SET confirmation_required = 0; create table sp_target_conf_status ( - id bigint not null auto_increment, - target_id bigint not null, - initiator varchar(64), - remark VARCHAR(512), - created_at bigint, - created_by varchar(64), - last_modified_at bigint, - last_modified_by varchar(64), - optlock_revision bigint, - tenant varchar(40) not null, + id bigint not null auto_increment, + target_id bigint not null, + initiator varchar(64), + remark VARCHAR(512), + created_at bigint, + created_by varchar(64), + last_modified_at bigint, + last_modified_by varchar(64), + optlock_revision bigint, + tenant varchar(40) not null, primary key (id) ); ALTER TABLE sp_target_conf_status diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_26__add_access_control_context___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_26__add_access_control_context___H2.sql index fb06922c7..ccf16963e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_26__add_access_control_context___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_26__add_access_control_context___H2.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_target_filter_query - ADD COLUMN access_control_context VARCHAR(4096); -ALTER TABLE sp_rollout - ADD COLUMN access_control_context VARCHAR(4096); \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD COLUMN access_control_context VARCHAR(4096); +ALTER TABLE sp_rollout ADD COLUMN access_control_context VARCHAR(4096); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_27__target_type_inherit_type___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_27__target_type_inherit_type___H2.sql index 2b63926eb..86e3350b8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_27__target_type_inherit_type___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_27__target_type_inherit_type___H2.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_target_type - ADD COLUMN type_key VARCHAR(64) NOT NULL DEFAULT ('_'); -UPDATE sp_target_type -SET type_key = name; -ALTER TABLE sp_target_type - ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file +ALTER TABLE sp_target_type ADD COLUMN type_key VARCHAR (64) NOT NULL DEFAULT ('_'); +UPDATE sp_target_type SET type_key = name; +ALTER TABLE sp_target_type ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_28__add_dynamic_rollout___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_28__add_dynamic_rollout___H2.sql index 117921dd1..f392ccd87 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_28__add_dynamic_rollout___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_28__add_dynamic_rollout___H2.sql @@ -1,17 +1,9 @@ -ALTER TABLE sp_rollout - ADD COLUMN is_dynamic BOOLEAN; -ALTER TABLE sp_rolloutgroup - ADD COLUMN is_dynamic BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE sp_rollout ADD COLUMN is_dynamic BOOLEAN; +ALTER TABLE sp_rolloutgroup ADD COLUMN is_dynamic BOOLEAN NOT NULL DEFAULT false; -UPDATE sp_rollout -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_action -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_target_filter_query -SET auto_assign_weight = 1000 -WHERE auto_assign_weight IS NULL; +UPDATE sp_rollout SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_action SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_target_filter_query SET auto_assign_weight = 1000 WHERE auto_assign_weight IS NULL; ALTER TABLE sp_rollout ALTER COLUMN weight INT NOT NULL; ALTER TABLE sp_action ALTER COLUMN weight INT NOT NULL; ALTER TABLE sp_target_filter_query ALTER COLUMN auto_assign_weight INT NOT NULL; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_29__add_ds_sm_locked___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_29__add_ds_sm_locked___H2.sql index 831528f40..c5c0de6fb 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_29__add_ds_sm_locked___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_29__add_ds_sm_locked___H2.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_base_software_module - ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; -ALTER TABLE sp_distribution_set - ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; \ No newline at end of file +ALTER TABLE sp_base_software_module ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; +ALTER TABLE sp_distribution_set ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_4__add_maintenance_window___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_4__add_maintenance_window___H2.sql index 9c817454f..6c546cede 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_4__add_maintenance_window___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_4__add_maintenance_window___H2.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_action - ADD column maintenance_cron_schedule VARCHAR(40); -ALTER TABLE sp_action - ADD column maintenance_duration VARCHAR(40); -ALTER TABLE sp_action - ADD column maintenance_time_zone VARCHAR(40); +ALTER TABLE sp_action ADD column maintenance_cron_schedule VARCHAR(40); +ALTER TABLE sp_action ADD column maintenance_duration VARCHAR(40); +ALTER TABLE sp_action ADD column maintenance_time_zone VARCHAR(40); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_6__add_index___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_6__add_index___H2.sql index 9fdbca2f8..d7d7d6cc7 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_6__add_index___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_6__add_index___H2.sql @@ -1,2 +1,2 @@ -CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name); +CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name); CREATE INDEX sp_idx_distribution_set_tag_01 ON sp_distributionset_tag (tenant, name); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_7__add_rollout_approval_fields___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_7__add_rollout_approval_fields___H2.sql index 3e8138835..8438d909e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_7__add_rollout_approval_fields___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_7__add_rollout_approval_fields___H2.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_rollout - ADD column approval_decided_by varchar(40); -ALTER TABLE sp_rollout - ADD column approval_remark varchar(255); \ No newline at end of file +ALTER TABLE sp_rollout ADD column approval_decided_by varchar(40); +ALTER TABLE sp_rollout ADD column approval_remark varchar(255); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_9__add_target_metadata___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_9__add_target_metadata___H2.sql index 02a23baaf..de70b7519 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_9__add_target_metadata___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_12_9__add_target_metadata___H2.sql @@ -1,13 +1,12 @@ -create table sp_target_metadata -( - meta_key varchar(128) not null, - meta_value varchar(4000), - target_id bigint not null, - primary key (target_id, meta_key) +create table sp_target_metadata ( + meta_key varchar(128) not null, + meta_value varchar(4000), + target_id bigint not null, + primary key (target_id, meta_key) ); - -alter table sp_target_metadata - add constraint fk_metadata_target - foreign key (target_id) - references sp_target - on delete cascade; \ No newline at end of file + +alter table sp_target_metadata + add constraint fk_metadata_target + foreign key (target_id) + references sp_target + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_2_0__update_target_info_for_message___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_2_0__update_target_info_for_message___H2.sql index a507d8afc..5bf96e631 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_2_0__update_target_info_for_message___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_2_0__update_target_info_for_message___H2.sql @@ -4,10 +4,10 @@ ALTER TABLE sp_target_info ALTER COLUMN ip_address RENAME TO address; ALTER TABLE sp_target_info ALTER COLUMN address VARCHAR(512); UPDATE sp_target_info -SET address = CONCAT('http://', (SELECT address - FROM sp_target_info i - WHERE sp_target_info.target_id = i.target_id)) +SET address = CONCAT('http://',(SELECT address + FROM sp_target_info i + WHERE sp_target_info.target_id = i.target_id)) WHERE EXISTS(SELECT target_id - FROM sp_target_info i - WHERE sp_target_info.target_id = i.target_id) - AND address != null; \ No newline at end of file + FROM sp_target_info i + WHERE sp_target_info.target_id = i.target_id) +AND address != null; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_4_0__cascade_delete___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_4_0__cascade_delete___H2.sql index 30d6f9229..7ed5e8d58 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_4_0__cascade_delete___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_4_0__cascade_delete___H2.sql @@ -1,69 +1,69 @@ alter table sp_target_info drop constraint fk_targ_stat_targ; -alter table sp_target_info - add constraint fk_targ_stat_targ - foreign key (target_id) - references sp_target - on delete cascade; +alter table sp_target_info + add constraint fk_targ_stat_targ + foreign key (target_id) + references sp_target + on delete cascade; alter table sp_action drop constraint fk_targ_act_hist_targ; -alter table sp_action - add constraint fk_targ_act_hist_targ - foreign key (target) - references sp_target - on delete cascade; +alter table sp_action + add constraint fk_targ_act_hist_targ + foreign key (target) + references sp_target + on delete cascade; -alter table sp_action_status drop constraint fk_act_stat_action; -alter table sp_action_status - add constraint fk_act_stat_action - foreign key (action) - references sp_action - on delete cascade; +alter table sp_action_status drop constraint fk_act_stat_action; +alter table sp_action_status + add constraint fk_act_stat_action + foreign key (action) + references sp_action + on delete cascade; -alter table sp_sw_metadata drop constraint fk_metadata_sw; -alter table sp_sw_metadata - add constraint fk_metadata_sw - foreign key (sw_id) - references sp_base_software_module - on delete cascade; - -alter table sp_ds_metadata drop constraint fk_metadata_ds; -alter table sp_ds_metadata - add constraint fk_metadata_ds - foreign key (ds_id) - references sp_distribution_set - on delete cascade; - -alter table sp_action_status_messages drop constraint fk_stat_msg_act_stat; -alter table sp_action_status_messages - add constraint fk_stat_msg_act_stat - foreign key (action_status_id) - references sp_action_status - on delete cascade; +alter table sp_sw_metadata drop constraint fk_metadata_sw; +alter table sp_sw_metadata + add constraint fk_metadata_sw + foreign key (sw_id) + references sp_base_software_module + on delete cascade; +alter table sp_ds_metadata drop constraint fk_metadata_ds; +alter table sp_ds_metadata + add constraint fk_metadata_ds + foreign key (ds_id) + references sp_distribution_set + on delete cascade; + +alter table sp_action_status_messages drop constraint fk_stat_msg_act_stat; +alter table sp_action_status_messages + add constraint fk_stat_msg_act_stat + foreign key (action_status_id) + references sp_action_status + on delete cascade; + alter table sp_ds_dstag drop constraint fk_ds_dstag_tag; -alter table sp_ds_dstag - add constraint fk_ds_dstag_tag - foreign key (TAG) - references sp_distributionset_tag - on delete cascade; - +alter table sp_ds_dstag + add constraint fk_ds_dstag_tag + foreign key (TAG) + references sp_distributionset_tag + on delete cascade; + alter table sp_ds_dstag drop constraint fk_ds_dstag_ds; -alter table sp_ds_dstag - add constraint fk_ds_dstag_ds - foreign key (ds) - references sp_distribution_set - on delete cascade; +alter table sp_ds_dstag + add constraint fk_ds_dstag_ds + foreign key (ds) + references sp_distribution_set + on delete cascade; alter table sp_target_target_tag drop constraint fk_targ_targtag_tag; -alter table sp_target_target_tag - add constraint fk_targ_targtag_tag - foreign key (tag) - references sp_target_tag - on delete cascade; +alter table sp_target_target_tag + add constraint fk_targ_targtag_tag + foreign key (tag) + references sp_target_tag + on delete cascade; alter table sp_target_target_tag drop constraint fk_targ_targtag_target; -alter table sp_target_target_tag - add constraint fk_targ_targtag_target - foreign key (target) - references sp_target - on delete cascade; \ No newline at end of file +alter table sp_target_target_tag + add constraint fk_targ_targtag_target + foreign key (target) + references sp_target + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_4_1__cascade_delete___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_4_1__cascade_delete___H2.sql index 0dc091108..915dac153 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_4_1__cascade_delete___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_4_1__cascade_delete___H2.sql @@ -1,6 +1,6 @@ alter table sp_target_attributes drop constraint fk_targ_attrib_target; -alter table sp_target_attributes - add constraint fk_targ_attrib_target - foreign key (target_id) - references sp_target_info - on delete cascade; \ No newline at end of file +alter table sp_target_attributes + add constraint fk_targ_attrib_target + foreign key (target_id) + references sp_target_info + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_5_0__target_filter_query___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_5_0__target_filter_query___H2.sql index d45c5f419..0cbc3744a 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_5_0__target_filter_query___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_5_0__target_filter_query___H2.sql @@ -1,15 +1,14 @@ -create table sp_target_filter_query -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - name varchar(64) not null, - query varchar(1024) not null, - primary key (id) + create table sp_target_filter_query ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + name varchar(64) not null, + query varchar(1024) not null, + primary key (id) ); create index sp_idx_target_filter_query_01 on sp_target_filter_query (tenant, name); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_6_0__rollout_management___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_6_0__rollout_management___H2.sql index cd100f890..490400161 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_6_0__rollout_management___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_6_0__rollout_management___H2.sql @@ -1,108 +1,103 @@ -create table sp_rolloutgroup -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - error_condition integer, - error_condition_exp varchar(512), - error_action integer, - error_action_exp varchar(512), - success_condition integer not null, - success_condition_exp varchar(512) not null, - success_action integer not null, - success_action_exp varchar(512), - status integer, - parent_id bigint, - rollout bigint, - total_targets bigint, - primary key (id) -); + create table sp_rolloutgroup ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + error_condition integer, + error_condition_exp varchar(512), + error_action integer, + error_action_exp varchar(512), + success_condition integer not null, + success_condition_exp varchar(512) not null, + success_action integer not null, + success_action_exp varchar(512), + status integer, + parent_id bigint, + rollout bigint, + total_targets bigint, + primary key (id) + ); + + create table sp_rollout ( + id bigint generated by default as identity, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + last_check bigint, + group_theshold float, + status integer, + distribution_set bigint, + target_filter varchar(1024), + action_type varchar(255) not null, + forced_time bigint, + total_targets bigint, + primary key (id) + ); + + create table sp_rollouttargetgroup ( + target_Id bigint not null, + rolloutGroup_Id bigint not null, + primary key (rolloutGroup_Id, target_Id) + ); + + create index sp_idx_rollout_01 on sp_rollout (tenant, name); + + create index sp_idx_rolloutgroup_01 on sp_rolloutgroup (tenant, name); + + ALTER TABLE sp_action ADD COLUMN rollout bigint; + ALTER TABLE sp_action ADD COLUMN rolloutgroup bigint; + + alter table sp_rollout + add constraint uk_rollout unique (name, tenant); + + alter table sp_rolloutgroup + add constraint uk_rolloutgroup unique (name, rollout, tenant); + + alter table sp_action + add constraint fk_action_rollout + foreign key (rollout) + references sp_rollout; + + alter table sp_action + add constraint fk_action_rolloutgroup + foreign key (rolloutgroup) + references sp_rolloutgroup; + + alter table sp_rollout + add constraint fk_rollout_ds + foreign key (distribution_set) + references sp_distribution_set; -create table sp_rollout -( - id bigint generated by default as identity, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - last_check bigint, - group_theshold float, - status integer, - distribution_set bigint, - target_filter varchar(1024), - action_type varchar(255) not null, - forced_time bigint, - total_targets bigint, - primary key (id) -); + alter table sp_rolloutgroup + add constraint fk_rolloutgroup_rollout + foreign key (rollout) + references sp_rollout + on delete cascade; + + alter table sp_rolloutgroup + add constraint fk_rolloutgroup_rolloutgroup + foreign key (parent_id) + references sp_rolloutgroup + on delete cascade; + + alter table sp_rollouttargetgroup + add constraint fk_rollouttargetgroup_target + foreign key (target_id) + references sp_target + on delete cascade; -create table sp_rollouttargetgroup -( - target_Id bigint not null, - rolloutGroup_Id bigint not null, - primary key (rolloutGroup_Id, target_Id) -); - -create index sp_idx_rollout_01 on sp_rollout (tenant, name); - -create index sp_idx_rolloutgroup_01 on sp_rolloutgroup (tenant, name); - -ALTER TABLE sp_action - ADD COLUMN rollout bigint; -ALTER TABLE sp_action - ADD COLUMN rolloutgroup bigint; - -alter table sp_rollout - add constraint uk_rollout unique (name, tenant); - -alter table sp_rolloutgroup - add constraint uk_rolloutgroup unique (name, rollout, tenant); - -alter table sp_action - add constraint fk_action_rollout - foreign key (rollout) - references sp_rollout; - -alter table sp_action - add constraint fk_action_rolloutgroup - foreign key (rolloutgroup) - references sp_rolloutgroup; - -alter table sp_rollout - add constraint fk_rollout_ds - foreign key (distribution_set) - references sp_distribution_set; - -alter table sp_rolloutgroup - add constraint fk_rolloutgroup_rollout - foreign key (rollout) - references sp_rollout - on delete cascade; - -alter table sp_rolloutgroup - add constraint fk_rolloutgroup_rolloutgroup - foreign key (parent_id) - references sp_rolloutgroup - on delete cascade; - -alter table sp_rollouttargetgroup - add constraint fk_rollouttargetgroup_target - foreign key (target_id) - references sp_target - on delete cascade; - -alter table sp_rollouttargetgroup - add constraint fk_rollouttargetgroup_rolloutgroup - foreign key (rolloutgroup_id) - references sp_rolloutgroup - on delete cascade; \ No newline at end of file + alter table sp_rollouttargetgroup + add constraint fk_rollouttargetgroup_rolloutgroup + foreign key (rolloutgroup_id) + references sp_rolloutgroup + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_7_0__swmType_maxAssignment_greater_0__H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_7_0__swmType_maxAssignment_greater_0__H2.sql index 75766d9dc..f79c9375c 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_7_0__swmType_maxAssignment_greater_0__H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_7_0__swmType_maxAssignment_greater_0__H2.sql @@ -1,3 +1 @@ -Update sp_software_module_type -set max_ds_assignments = 1 -where max_ds_assignments < 1; \ No newline at end of file +Update sp_software_module_type set max_ds_assignments = 1 where max_ds_assignments < 1; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_8_0__auto_assign_ds_filter__H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_8_0__auto_assign_ds_filter__H2.sql index f4d7f0169..2d56f27f2 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_8_0__auto_assign_ds_filter__H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_8_0__auto_assign_ds_filter__H2.sql @@ -1,8 +1,8 @@ ALTER TABLE sp_target_filter_query - ADD column auto_assign_distribution_set BIGINT; + ADD column auto_assign_distribution_set BIGINT; ALTER TABLE sp_target_filter_query - ADD CONSTRAINT fk_filter_auto_assign_ds - FOREIGN KEY (auto_assign_distribution_set) - REFERENCES sp_distribution_set - ON DELETE SET NULL; + ADD CONSTRAINT fk_filter_auto_assign_ds +FOREIGN KEY (auto_assign_distribution_set) +REFERENCES sp_distribution_set +ON DELETE SET NULL; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_8_1__cascade_delete___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_8_1__cascade_delete___H2.sql index 2235078c3..0c6225fae 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_8_1__cascade_delete___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_8_1__cascade_delete___H2.sql @@ -1,27 +1,27 @@ alter table sp_ds_module drop constraint fk_ds_module_ds; -alter table sp_ds_module - add constraint fk_ds_module_ds - foreign key (ds_id) - references sp_distribution_set (id) - on delete cascade; +alter table sp_ds_module + add constraint fk_ds_module_ds + foreign key (ds_id) + references sp_distribution_set (id) + on delete cascade; alter table sp_ds_module drop constraint fk_ds_module_module; -alter table sp_ds_module - add constraint fk_ds_module_module - foreign key (module_id) - references sp_base_software_module (id) - on delete cascade; +alter table sp_ds_module + add constraint fk_ds_module_module + foreign key (module_id) + references sp_base_software_module (id) + on delete cascade; alter table sp_external_artifact drop constraint fk_external_assigned_sm; -alter table sp_external_artifact - add constraint fk_external_assigned_sm - foreign key (software_module) - references sp_base_software_module (id) - on delete cascade; +alter table sp_external_artifact + add constraint fk_external_assigned_sm + foreign key (software_module) + references sp_base_software_module (id) + on delete cascade; alter table sp_artifact drop constraint fk_assigned_sm; -alter table sp_artifact - add constraint fk_assigned_sm - foreign key (software_module) - references sp_base_software_module (id) - on delete cascade; \ No newline at end of file +alter table sp_artifact + add constraint fk_assigned_sm + foreign key (software_module) + references sp_base_software_module (id) + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_9_0__add_rollout_groups_created___H2.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_9_0__add_rollout_groups_created___H2.sql index bbcd2d6af..64518f762 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_9_0__add_rollout_groups_created___H2.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/H2/V1_9_0__add_rollout_groups_created___H2.sql @@ -1,3 +1,2 @@ -ALTER TABLE sp_rollout - ADD column rollout_groups_created BIGINT; + ALTER TABLE sp_rollout ADD column rollout_groups_created BIGINT; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_0_1__init___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_0_1__init___MYSQL.sql index ac7dc0053..ec243a68b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_0_1__init___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_0_1__init___MYSQL.sql @@ -1,516 +1,494 @@ -create table sp_action -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - action_type varchar(255) not null, - active bit, - forced_time bigint, - status integer, - distribution_set bigint, - target bigint, - primary key (id) -); - -create table sp_action_status -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - target_occurred_at bigint, - status integer, - action bigint not null, - primary key (id) -); - -create table sp_action_status_messages -( - action_status_id bigint not null, - detail_message varchar(512) -); - -create table sp_artifact -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - md5_hash varchar(32), - sha1_hash varchar(40), - file_size bigint, - provided_file_name varchar(256), - gridfs_file_name varchar(40), - software_module bigint not null, - primary key (id) -); - -create table sp_base_software_module -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - version varchar(64) not null, - deleted bit, - vendor varchar(256), - module_type bigint not null, - primary key (id) -); - -create table sp_distribution_set -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - version varchar(64) not null, - complete bit, - deleted bit, - required_migration_step bit, - ds_id bigint not null, - primary key (id) -); - -create table sp_distribution_set_type -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - colour varchar(16), - deleted bit, - type_key varchar(64) not null, - primary key (id) -); - -create table sp_distributionset_tag -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - colour varchar(16), - primary key (id) -); - -create table sp_ds_dstag -( - ds bigint not null, - TAG bigint not null, - primary key (ds, TAG) -); - -create table sp_ds_metadata -( - meta_key varchar(128) not null, - meta_value varchar(4000), - ds_id bigint not null, - primary key (ds_id, meta_key) -); - -create table sp_ds_module -( - ds_id bigint not null, - module_id bigint not null, - primary key (ds_id, module_id) -); - -create table sp_ds_type_element -( - mandatory bit, - distribution_set_type bigint not null, - software_module_type bigint not null, - primary key (distribution_set_type, software_module_type) -); - -create table sp_external_artifact -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - md5_hash varchar(32), - sha1_hash varchar(40), - file_size bigint, - url_suffix varchar(512), - provider bigint not null, - software_module bigint not null, - primary key (id) -); - -create table sp_external_provider -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - base_url varchar(512) not null, - default_url_suffix varchar(512), - primary key (id) -); - -create table sp_software_module_type -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - colour varchar(16), - deleted bit, - type_key varchar(64) not null, - max_ds_assignments integer not null, - primary key (id) -); - -create table sp_sw_metadata -( - meta_key varchar(128) not null, - meta_value varchar(4000), - sw_id bigint not null, - primary key (meta_key, sw_id) -); - -create table sp_target -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - controller_id varchar(64), - sec_token varchar(128) not null, - assigned_distribution_set bigint, - primary key (id) -); - -create table sp_target_attributes -( - target_id bigint not null, - attribute_value varchar(128), - attribute_key varchar(32) not null, - primary key (target_id, attribute_key) -); - -create table sp_target_info -( - target_id bigint not null, - install_date bigint, - ip_address varchar(46), - last_target_query bigint, - request_controller_attributes bit not null, - update_status varchar(255) not null, - installed_distribution_set bigint, - primary key (target_id) -); - -create table sp_target_tag -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - colour varchar(16), - primary key (id) -); - -create table sp_target_target_tag -( - target bigint not null, - tag bigint not null, - primary key (target, tag) -); - -create table sp_tenant -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - default_ds_type bigint not null, - primary key (id) -); - -create table sp_tenant_configuration -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - conf_key varchar(128), - conf_value varchar(512), - primary key (id) -); -create index sp_idx_action_01 on sp_action (tenant, distribution_set); + create table sp_action ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + action_type varchar(255) not null, + active bit, + forced_time bigint, + status integer, + distribution_set bigint, + target bigint, + primary key (id) + ); + + create table sp_action_status ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + target_occurred_at bigint, + status integer, + action bigint not null, + primary key (id) + ); + + create table sp_action_status_messages ( + action_status_id bigint not null, + detail_message varchar(512) + ); + + create table sp_artifact ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + md5_hash varchar(32), + sha1_hash varchar(40), + file_size bigint, + provided_file_name varchar(256), + gridfs_file_name varchar(40), + software_module bigint not null, + primary key (id) + ); + + create table sp_base_software_module ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + version varchar(64) not null, + deleted bit, + vendor varchar(256), + module_type bigint not null, + primary key (id) + ); + + create table sp_distribution_set ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + version varchar(64) not null, + complete bit, + deleted bit, + required_migration_step bit, + ds_id bigint not null, + primary key (id) + ); + + create table sp_distribution_set_type ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + colour varchar(16), + deleted bit, + type_key varchar(64) not null, + primary key (id) + ); + + create table sp_distributionset_tag ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + colour varchar(16), + primary key (id) + ); + + create table sp_ds_dstag ( + ds bigint not null, + TAG bigint not null, + primary key (ds, TAG) + ); + + create table sp_ds_metadata ( + meta_key varchar(128) not null, + meta_value varchar(4000), + ds_id bigint not null, + primary key (ds_id, meta_key) + ); + + create table sp_ds_module ( + ds_id bigint not null, + module_id bigint not null, + primary key (ds_id, module_id) + ); + + create table sp_ds_type_element ( + mandatory bit, + distribution_set_type bigint not null, + software_module_type bigint not null, + primary key (distribution_set_type, software_module_type) + ); + + create table sp_external_artifact ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + md5_hash varchar(32), + sha1_hash varchar(40), + file_size bigint, + url_suffix varchar(512), + provider bigint not null, + software_module bigint not null, + primary key (id) + ); + + create table sp_external_provider ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + base_url varchar(512) not null, + default_url_suffix varchar(512), + primary key (id) + ); + + create table sp_software_module_type ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + colour varchar(16), + deleted bit, + type_key varchar(64) not null, + max_ds_assignments integer not null, + primary key (id) + ); + + create table sp_sw_metadata ( + meta_key varchar(128) not null, + meta_value varchar(4000), + sw_id bigint not null, + primary key (meta_key, sw_id) + ); + + create table sp_target ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + controller_id varchar(64), + sec_token varchar(128) not null, + assigned_distribution_set bigint, + primary key (id) + ); + + create table sp_target_attributes ( + target_id bigint not null, + attribute_value varchar(128), + attribute_key varchar(32) not null, + primary key (target_id, attribute_key) + ); + + create table sp_target_info ( + target_id bigint not null, + install_date bigint, + ip_address varchar(46), + last_target_query bigint, + request_controller_attributes bit not null, + update_status varchar(255) not null, + installed_distribution_set bigint, + primary key (target_id) + ); + + create table sp_target_tag ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + colour varchar(16), + primary key (id) + ); + + create table sp_target_target_tag ( + target bigint not null, + tag bigint not null, + primary key (target, tag) + ); + + create table sp_tenant ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + default_ds_type bigint not null, + primary key (id) + ); + + create table sp_tenant_configuration ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + conf_key varchar(128), + conf_value varchar(512), + primary key (id) + ); -create index sp_idx_action_02 on sp_action (tenant, target, active); + create index sp_idx_action_01 on sp_action (tenant, distribution_set); -create index sp_idx_action_prim on sp_action (tenant, id); + create index sp_idx_action_02 on sp_action (tenant, target, active); -create index sp_idx_action_status_01 on sp_action_status (tenant, action); + create index sp_idx_action_prim on sp_action (tenant, id); -create index sp_idx_action_status_02 on sp_action_status (tenant, action, status); + create index sp_idx_action_status_01 on sp_action_status (tenant, action); -create index sp_idx_action_status_prim on sp_action_status (tenant, id); + create index sp_idx_action_status_02 on sp_action_status (tenant, action, status); -create index sp_idx_action_status_msgs_01 on sp_action_status_messages (action_status_id); + create index sp_idx_action_status_prim on sp_action_status (tenant, id); -create index sp_idx_artifact_01 on sp_artifact (tenant, software_module); + create index sp_idx_action_status_msgs_01 on sp_action_status_messages (action_status_id); -create index sp_idx_artifact_prim on sp_artifact (tenant, id); + create index sp_idx_artifact_01 on sp_artifact (tenant, software_module); -alter table sp_base_software_module - add constraint uk_base_sw_mod unique (module_type, name, version, tenant); + create index sp_idx_artifact_prim on sp_artifact (tenant, id); -create index sp_idx_base_sw_module_01 on sp_base_software_module (tenant, deleted, name, version); + alter table sp_base_software_module + add constraint uk_base_sw_mod unique (module_type, name, version, tenant); -create index sp_idx_base_sw_module_02 on sp_base_software_module (tenant, deleted, module_type); + create index sp_idx_base_sw_module_01 on sp_base_software_module (tenant, deleted, name, version); -create index sp_idx_base_sw_module_prim on sp_base_software_module (tenant, id); + create index sp_idx_base_sw_module_02 on sp_base_software_module (tenant, deleted, module_type); -alter table sp_distribution_set - add constraint uk_distrib_set unique (name, version, tenant); + create index sp_idx_base_sw_module_prim on sp_base_software_module (tenant, id); -create index sp_idx_distribution_set_01 on sp_distribution_set (tenant, deleted, name, complete); + alter table sp_distribution_set + add constraint uk_distrib_set unique (name, version, tenant); -create index sp_idx_distribution_set_02 on sp_distribution_set (tenant, required_migration_step); + create index sp_idx_distribution_set_01 on sp_distribution_set (tenant, deleted, name, complete); -create index sp_idx_distribution_set_prim on sp_distribution_set (tenant, id); + create index sp_idx_distribution_set_02 on sp_distribution_set (tenant, required_migration_step); -alter table sp_distribution_set_type - add constraint uk_dst_name unique (name, tenant); + create index sp_idx_distribution_set_prim on sp_distribution_set (tenant, id); -alter table sp_distribution_set_type - add constraint uk_dst_key unique (type_key, tenant); + alter table sp_distribution_set_type + add constraint uk_dst_name unique (name, tenant); -create index sp_idx_distribution_set_type_01 on sp_distribution_set_type (tenant, deleted); + alter table sp_distribution_set_type + add constraint uk_dst_key unique (type_key, tenant); -create index sp_idx_distribution_set_type_prim on sp_distribution_set_type (tenant, id); + create index sp_idx_distribution_set_type_01 on sp_distribution_set_type (tenant, deleted); -alter table sp_distributionset_tag - add constraint uk_ds_tag unique (name, tenant); + create index sp_idx_distribution_set_type_prim on sp_distribution_set_type (tenant, id); -create index sp_idx_distribution_set_tag_prim on sp_distributionset_tag (tenant, id); + alter table sp_distributionset_tag + add constraint uk_ds_tag unique (name, tenant); -create index sp_idx_external_artifact_prim on sp_external_artifact (id, tenant); + create index sp_idx_distribution_set_tag_prim on sp_distributionset_tag (tenant, id); -create index sp_idx_external_provider_prim on sp_external_provider (tenant, id); + create index sp_idx_external_artifact_prim on sp_external_artifact (id, tenant); -alter table sp_software_module_type - add constraint uk_smt_type_key unique (type_key, tenant); + create index sp_idx_external_provider_prim on sp_external_provider (tenant, id); -alter table sp_software_module_type - add constraint uk_smt_name unique (name, tenant); + alter table sp_software_module_type + add constraint uk_smt_type_key unique (type_key, tenant); -create index sp_idx_software_module_type_01 on sp_software_module_type (tenant, deleted); + alter table sp_software_module_type + add constraint uk_smt_name unique (name, tenant); -create index sp_idx_software_module_type_prim on sp_software_module_type (tenant, id); + create index sp_idx_software_module_type_01 on sp_software_module_type (tenant, deleted); -alter table sp_target - add constraint uk_tenant_controller_id unique (controller_id, tenant); + create index sp_idx_software_module_type_prim on sp_software_module_type (tenant, id); -create index sp_idx_target_01 on sp_target (tenant, name, assigned_distribution_set); + alter table sp_target + add constraint uk_tenant_controller_id unique (controller_id, tenant); -create index sp_idx_target_02 on sp_target (tenant, name); + create index sp_idx_target_01 on sp_target (tenant, name, assigned_distribution_set); -create index sp_idx_target_03 on sp_target (tenant, controller_id, assigned_distribution_set); + create index sp_idx_target_02 on sp_target (tenant, name); -create index sp_idx_target_04 on sp_target (tenant, created_at); + create index sp_idx_target_03 on sp_target (tenant, controller_id, assigned_distribution_set); + + create index sp_idx_target_04 on sp_target (tenant, created_at); -create index sp_idx_target_prim on sp_target (tenant, id); + create index sp_idx_target_prim on sp_target (tenant, id); -create index sp_idx_target_info_01 on sp_target_info (ip_address); + create index sp_idx_target_info_01 on sp_target_info (ip_address); -create index sp_idx_target_info_02 on sp_target_info (target_id, update_status); + create index sp_idx_target_info_02 on sp_target_info (target_id, update_status); -alter table sp_target_tag - add constraint uk_targ_tag unique (name, tenant); + alter table sp_target_tag + add constraint uk_targ_tag unique (name, tenant); -create index sp_idx_target_tag_prim on sp_target_tag (tenant, id); + create index sp_idx_target_tag_prim on sp_target_tag (tenant, id); -alter table sp_tenant - add constraint uk_tenantmd_tenant unique (tenant); + alter table sp_tenant + add constraint uk_tenantmd_tenant unique (tenant); -create index sp_idx_tenant_prim on sp_tenant (tenant, id); + create index sp_idx_tenant_prim on sp_tenant (tenant, id); -alter table sp_tenant_configuration - add constraint uk_tenant_key unique (conf_key, tenant); + alter table sp_tenant_configuration + add constraint uk_tenant_key unique (conf_key, tenant); -alter table sp_action - add constraint fk_action_ds - foreign key (distribution_set) - references sp_distribution_set (id); + alter table sp_action + add constraint fk_action_ds + foreign key (distribution_set) + references sp_distribution_set (id); -alter table sp_action - add constraint fk_targ_act_hist_targ - foreign key (target) - references sp_target (id); + alter table sp_action + add constraint fk_targ_act_hist_targ + foreign key (target) + references sp_target (id); -alter table sp_action_status - add constraint fk_act_stat_action - foreign key (action) - references sp_action (id); + alter table sp_action_status + add constraint fk_act_stat_action + foreign key (action) + references sp_action (id); -alter table sp_action_status_messages - add constraint fk_stat_msg_act_stat - foreign key (action_status_id) - references sp_action_status (id); + alter table sp_action_status_messages + add constraint fk_stat_msg_act_stat + foreign key (action_status_id) + references sp_action_status (id); -alter table sp_artifact - add constraint fk_assigned_sm - foreign key (software_module) - references sp_base_software_module (id); + alter table sp_artifact + add constraint fk_assigned_sm + foreign key (software_module) + references sp_base_software_module (id); -alter table sp_base_software_module - add constraint fk_module_type - foreign key (module_type) - references sp_software_module_type (id); + alter table sp_base_software_module + add constraint fk_module_type + foreign key (module_type) + references sp_software_module_type (id); -alter table sp_distribution_set - add constraint fk_ds_dstype_ds - foreign key (ds_id) - references sp_distribution_set_type (id); + alter table sp_distribution_set + add constraint fk_ds_dstype_ds + foreign key (ds_id) + references sp_distribution_set_type (id); -alter table sp_ds_dstag - add constraint fk_ds_dstag_tag - foreign key (TAG) - references sp_distributionset_tag (id); + alter table sp_ds_dstag + add constraint fk_ds_dstag_tag + foreign key (TAG) + references sp_distributionset_tag (id); -alter table sp_ds_dstag - add constraint fk_ds_dstag_ds - foreign key (ds) - references sp_distribution_set (id); + alter table sp_ds_dstag + add constraint fk_ds_dstag_ds + foreign key (ds) + references sp_distribution_set (id); -alter table sp_ds_metadata - add constraint fk_metadata_ds - foreign key (ds_id) - references sp_distribution_set (id); + alter table sp_ds_metadata + add constraint fk_metadata_ds + foreign key (ds_id) + references sp_distribution_set (id); -alter table sp_ds_module - add constraint fk_ds_module_module - foreign key (module_id) - references sp_base_software_module (id); + alter table sp_ds_module + add constraint fk_ds_module_module + foreign key (module_id) + references sp_base_software_module (id); -alter table sp_ds_module - add constraint fk_ds_module_ds - foreign key (ds_id) - references sp_distribution_set (id); + alter table sp_ds_module + add constraint fk_ds_module_ds + foreign key (ds_id) + references sp_distribution_set (id); -alter table sp_ds_type_element - add constraint fk_ds_type_element_element - foreign key (distribution_set_type) - references sp_distribution_set_type (id); + alter table sp_ds_type_element + add constraint fk_ds_type_element_element + foreign key (distribution_set_type) + references sp_distribution_set_type (id); -alter table sp_ds_type_element - add constraint fk_ds_type_element_smtype - foreign key (software_module_type) - references sp_software_module_type (id); - -alter table sp_external_artifact - add constraint fk_art_to_ext_provider - foreign key (provider) - references sp_external_provider (id); - -alter table sp_external_artifact - add constraint fk_external_assigned_sm - foreign key (software_module) - references sp_base_software_module (id); - -alter table sp_sw_metadata - add constraint fk_metadata_sw - foreign key (sw_id) - references sp_base_software_module (id); - -alter table sp_target - add constraint fk_target_assign_ds - foreign key (assigned_distribution_set) - references sp_distribution_set (id); - -alter table sp_target_attributes - add constraint fk_targ_attrib_target - foreign key (target_id) - references sp_target_info (target_id); - -alter table sp_target_info - add constraint fk_target_inst_ds - foreign key (installed_distribution_set) - references sp_distribution_set (id); - -alter table sp_target_info - add constraint fk_targ_stat_targ - foreign key (target_id) - references sp_target (id); - -alter table sp_target_target_tag - add constraint fk_targ_targtag_tag - foreign key (tag) - references sp_target_tag (id); - -alter table sp_target_target_tag - add constraint fk_targ_targtag_target - foreign key (target) - references sp_target (id); - -alter table sp_tenant - add constraint fk_tenant_md_default_ds_type - foreign key (default_ds_type) - references sp_distribution_set_type (id); + alter table sp_ds_type_element + add constraint fk_ds_type_element_smtype + foreign key (software_module_type) + references sp_software_module_type (id); + + alter table sp_external_artifact + add constraint fk_art_to_ext_provider + foreign key (provider) + references sp_external_provider (id); + + alter table sp_external_artifact + add constraint fk_external_assigned_sm + foreign key (software_module) + references sp_base_software_module (id); + + alter table sp_sw_metadata + add constraint fk_metadata_sw + foreign key (sw_id) + references sp_base_software_module (id); + + alter table sp_target + add constraint fk_target_assign_ds + foreign key (assigned_distribution_set) + references sp_distribution_set (id); + + alter table sp_target_attributes + add constraint fk_targ_attrib_target + foreign key (target_id) + references sp_target_info (target_id); + + alter table sp_target_info + add constraint fk_target_inst_ds + foreign key (installed_distribution_set) + references sp_distribution_set (id); + + alter table sp_target_info + add constraint fk_targ_stat_targ + foreign key (target_id) + references sp_target (id); + + alter table sp_target_target_tag + add constraint fk_targ_targtag_tag + foreign key (tag) + references sp_target_tag (id); + + alter table sp_target_target_tag + add constraint fk_targ_targtag_target + foreign key (target) + references sp_target (id); + + alter table sp_tenant + add constraint fk_tenant_md_default_ds_type + foreign key (default_ds_type) + references sp_distribution_set_type (id); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_0__advanced_rolloutgroup__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_0__advanced_rolloutgroup__MYSQL.sql index 27c73472e..7c4954ad8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_0__advanced_rolloutgroup__MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_0__advanced_rolloutgroup__MYSQL.sql @@ -1,4 +1,4 @@ ALTER TABLE sp_rolloutgroup - ADD COLUMN target_percentage FLOAT; + ADD COLUMN target_percentage FLOAT; ALTER TABLE sp_rolloutgroup - ADD COLUMN target_filter VARCHAR(1024); + ADD COLUMN target_filter VARCHAR (1024); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_1__consolidate_artifact_sha1__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_1__consolidate_artifact_sha1__MYSQL.sql index 9c2ed1c23..05b34fd5f 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_1__consolidate_artifact_sha1__MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_1__consolidate_artifact_sha1__MYSQL.sql @@ -1,3 +1,3 @@ ALTER TABLE sp_artifact DROP COLUMN sha1_hash; -ALTER TABLE sp_artifact CHANGE gridfs_file_name sha1_hash varchar (40) not null; +ALTER TABLE sp_artifact CHANGE gridfs_file_name sha1_hash varchar(40) not null; CREATE INDEX sp_idx_artifact_02 ON sp_artifact (tenant, sha1_hash); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_2__rollout_auto_start__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_2__rollout_auto_start__MYSQL.sql index 14f2a7abb..e946026f3 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_2__rollout_auto_start__MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_2__rollout_auto_start__MYSQL.sql @@ -1,2 +1,2 @@ ALTER TABLE sp_rollout - ADD COLUMN start_at BIGINT; + ADD COLUMN start_at BIGINT; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_3__add_rollout_deleted_flag__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_3__add_rollout_deleted_flag__MYSQL.sql index bbe81787e..ed184162e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_3__add_rollout_deleted_flag__MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_10_3__add_rollout_deleted_flag__MYSQL.sql @@ -1,8 +1,6 @@ -ALTER TABLE sp_rollout - ADD COLUMN deleted BOOLEAN; +ALTER TABLE sp_rollout ADD COLUMN deleted BOOLEAN; -UPDATE sp_rollout -SET deleted = 0; +UPDATE sp_rollout SET deleted = 0; ALTER TABLE sp_action MODIFY target BIGINT NOT NULL; ALTER TABLE sp_action MODIFY distribution_set BIGINT NOT NULL; @@ -14,15 +12,15 @@ ALTER TABLE sp_rolloutgroup MODIFY rollout BIGINT NOT NULL; ALTER TABLE sp_rolloutgroup MODIFY status INTEGER NOT NULL; ALTER TABLE sp_ds_type_element DROP FOREIGN KEY fk_ds_type_element_element; -ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_element - FOREIGN KEY (distribution_set_type) - REFERENCES sp_distribution_set_type (id) - ON DELETE CASCADE; +ALTER TABLE sp_ds_type_element + ADD CONSTRAINT fk_ds_type_element_element + FOREIGN KEY (distribution_set_type) + REFERENCES sp_distribution_set_type (id) + ON DELETE CASCADE; ALTER TABLE sp_ds_type_element DROP FOREIGN KEY fk_ds_type_element_smtype; -ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_smtype - FOREIGN KEY (software_module_type) - REFERENCES sp_software_module_type (id) - ON DELETE CASCADE; +ALTER TABLE sp_ds_type_element + ADD CONSTRAINT fk_ds_type_element_smtype + FOREIGN KEY (software_module_type) + REFERENCES sp_software_module_type (id) + ON DELETE CASCADE; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_0__drop_target_info__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_0__drop_target_info__MYSQL.sql index f225f65cc..f170e0f22 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_0__drop_target_info__MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_0__drop_target_info__MYSQL.sql @@ -1,34 +1,30 @@ -ALTER TABLE sp_target - ADD COLUMN install_date bigint; -ALTER TABLE sp_target - ADD COLUMN address varchar(512); -ALTER TABLE sp_target - ADD COLUMN last_target_query bigint; -ALTER TABLE sp_target - ADD COLUMN request_controller_attributes bit not null; -ALTER TABLE sp_target - ADD COLUMN update_status varchar(16) not null; -ALTER TABLE sp_target - ADD COLUMN installed_distribution_set bigint; +ALTER TABLE sp_target ADD COLUMN install_date bigint; +ALTER TABLE sp_target ADD COLUMN address varchar(512); +ALTER TABLE sp_target ADD COLUMN last_target_query bigint; +ALTER TABLE sp_target ADD COLUMN request_controller_attributes bit not null; +ALTER TABLE sp_target ADD COLUMN update_status varchar(16) not null; +ALTER TABLE sp_target ADD COLUMN installed_distribution_set bigint; UPDATE sp_target AS t INNER JOIN sp_target_info AS i -ON t.id = i.target_id - SET t.install_date = i.install_date, t.address = i.address, t.last_target_query = i.last_target_query, t.request_controller_attributes = i.request_controller_attributes, t.update_status = i.update_status, t.installed_distribution_set = i.installed_distribution_set; + ON t.id = i.target_id +SET t.install_date = i.install_date, t.address = i.address,t.last_target_query = i.last_target_query, + t.request_controller_attributes = i.request_controller_attributes,t.update_status = i.update_status, + t.installed_distribution_set = i.installed_distribution_set; ALTER TABLE sp_target_info DROP INDEX sp_idx_target_info_02; ALTER TABLE sp_target_attributes DROP FOREIGN KEY fk_targ_attrib_target; -ALTER TABLE sp_target_attributes - ADD CONSTRAINT fk_targ_attrib_target - FOREIGN KEY (target_id) - REFERENCES sp_target (id) - ON DELETE cascade; +ALTER TABLE sp_target_attributes + ADD CONSTRAINT fk_targ_attrib_target + FOREIGN KEY (target_id) + REFERENCES sp_target (id) + ON DELETE cascade; -ALTER TABLE sp_target_info DROP FOREIGN KEY fk_target_inst_ds; -ALTER TABLE sp_target - ADD CONSTRAINT fk_target_inst_ds - FOREIGN KEY (installed_distribution_set) - REFERENCES sp_distribution_set (id); +ALTER TABLE sp_target_info DROP FOREIGN KEY fk_target_inst_ds; +ALTER TABLE sp_target + ADD CONSTRAINT fk_target_inst_ds + FOREIGN KEY (installed_distribution_set) + REFERENCES sp_distribution_set (id); ALTER TABLE sp_target_info DROP FOREIGN KEY fk_targ_stat_targ; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_1__target_filter_query_UQ___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_1__target_filter_query_UQ___MYSQL.sql index fc1f615ba..f494313a8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_1__target_filter_query_UQ___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_1__target_filter_query_UQ___MYSQL.sql @@ -1,2 +1,2 @@ -alter table sp_target_filter_query - add constraint uk_tenant_custom_filter_name unique (name, tenant); + alter table sp_target_filter_query + add constraint uk_tenant_custom_filter_name unique (name, tenant); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_3__add_module_md_targetvis__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_3__add_module_md_targetvis__MYSQL.sql index fba01b8e3..4165f7ed1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_3__add_module_md_targetvis__MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_11_3__add_module_md_targetvis__MYSQL.sql @@ -1,2 +1 @@ -ALTER TABLE sp_sw_metadata - ADD COLUMN target_visible bit; \ No newline at end of file +ALTER TABLE sp_sw_metadata ADD COLUMN target_visible bit; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_0__action_performance___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_0__action_performance___MYSQL.sql index 05ba3cf12..1dff4e13a 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_0__action_performance___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_0__action_performance___MYSQL.sql @@ -1,34 +1,25 @@ -ALTER TABLE sp_action - ADD COLUMN action_type_new integer not null; -UPDATE sp_action -SET action_type_new = - CASE - WHEN (action_type = 'SOFT') THEN 1 - WHEN (action_type = 'TIMEFORCED') THEN 2 - ELSE 0 END; +ALTER TABLE sp_action ADD COLUMN action_type_new integer not null; +UPDATE sp_action SET action_type_new = +CASE WHEN (action_type = 'SOFT') THEN 1 + WHEN (action_type = 'TIMEFORCED') THEN 2 + ELSE 0 END; ALTER TABLE sp_action DROP COLUMN action_type; ALTER TABLE sp_action CHANGE COLUMN action_type_new action_type integer; -ALTER TABLE sp_rollout - ADD COLUMN action_type_new integer not null; -UPDATE sp_rollout -SET action_type_new = - CASE - WHEN (action_type = 'SOFT') THEN 1 - WHEN (action_type = 'TIMEFORCED') THEN 2 - ELSE 0 END; +ALTER TABLE sp_rollout ADD COLUMN action_type_new integer not null; +UPDATE sp_rollout SET action_type_new = +CASE WHEN (action_type = 'SOFT') THEN 1 + WHEN (action_type = 'TIMEFORCED') THEN 2 + ELSE 0 END; ALTER TABLE sp_rollout DROP COLUMN action_type; ALTER TABLE sp_rollout CHANGE COLUMN action_type_new action_type integer; -ALTER TABLE sp_target - ADD COLUMN update_status_new integer not null; -UPDATE sp_target -SET update_status_new = - CASE - WHEN (update_status = 'IN_SYNC') THEN 1 - WHEN (update_status = 'PENDING') THEN 2 - WHEN (update_status = 'ERROR') THEN 3 - WHEN (update_status = 'REGISTERED') THEN 4 - ELSE 0 END; +ALTER TABLE sp_target ADD COLUMN update_status_new integer not null; +UPDATE sp_target SET update_status_new = +CASE WHEN (update_status = 'IN_SYNC') THEN 1 + WHEN (update_status = 'PENDING') THEN 2 + WHEN (update_status = 'ERROR') THEN 3 + WHEN (update_status = 'REGISTERED') THEN 4 + ELSE 0 END; ALTER TABLE sp_target DROP COLUMN update_status; ALTER TABLE sp_target CHANGE COLUMN update_status_new update_status integer; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_10__change_length_of_target_attributes_key___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_10__change_length_of_target_attributes_key___MYSQL.sql index 37fd46b20..aeec222c2 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_10__change_length_of_target_attributes_key___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_10__change_length_of_target_attributes_key___MYSQL.sql @@ -1 +1 @@ -ALTER TABLE sp_target_attributes MODIFY attribute_key VARCHAR (128); \ No newline at end of file +ALTER TABLE sp_target_attributes MODIFY attribute_key VARCHAR(128); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_11__add_auto_assign_action_type___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_11__add_auto_assign_action_type___MYSQL.sql index ee00de0e6..16cb03ef2 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_11__add_auto_assign_action_type___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_11__add_auto_assign_action_type___MYSQL.sql @@ -1,2 +1 @@ -ALTER TABLE sp_target_filter_query - ADD COLUMN auto_assign_action_type integer; \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_action_type integer; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_12__change_length_of_controller_id_and_name___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_12__change_length_of_controller_id_and_name___MYSQL.sql index 44077c4b2..32b39dd59 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_12__change_length_of_controller_id_and_name___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_12__change_length_of_controller_id_and_name___MYSQL.sql @@ -1,13 +1,13 @@ -ALTER TABLE sp_distribution_set MODIFY name VARCHAR (128); -ALTER TABLE sp_distribution_set_type MODIFY name VARCHAR (128); -ALTER TABLE sp_distributionset_tag MODIFY name VARCHAR (128); -ALTER TABLE sp_base_software_module MODIFY name VARCHAR (128); -ALTER TABLE sp_rollout MODIFY name VARCHAR (128); -ALTER TABLE sp_rolloutgroup MODIFY name VARCHAR (128); -ALTER TABLE sp_software_module_type MODIFY name VARCHAR (128); -ALTER TABLE sp_target MODIFY name VARCHAR (128); -ALTER TABLE sp_target_filter_query MODIFY name VARCHAR (128); -ALTER TABLE sp_target_tag MODIFY name VARCHAR (128); +ALTER TABLE sp_distribution_set MODIFY name VARCHAR(128); +ALTER TABLE sp_distribution_set_type MODIFY name VARCHAR(128); +ALTER TABLE sp_distributionset_tag MODIFY name VARCHAR(128); +ALTER TABLE sp_base_software_module MODIFY name VARCHAR(128); +ALTER TABLE sp_rollout MODIFY name VARCHAR(128); +ALTER TABLE sp_rolloutgroup MODIFY name VARCHAR(128); +ALTER TABLE sp_software_module_type MODIFY name VARCHAR(128); +ALTER TABLE sp_target MODIFY name VARCHAR(128); +ALTER TABLE sp_target_filter_query MODIFY name VARCHAR(128); +ALTER TABLE sp_target_tag MODIFY name VARCHAR(128); -ALTER TABLE sp_target MODIFY controller_id VARCHAR (256); +ALTER TABLE sp_target MODIFY controller_id VARCHAR(256); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_13__add_action_external_id___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_13__add_action_external_id___MYSQL.sql index 2556b7d21..8dbda293f 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_13__add_action_external_id___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_13__add_action_external_id___MYSQL.sql @@ -1,5 +1,4 @@ -ALTER TABLE sp_action - ADD COLUMN external_ref VARCHAR(512); +ALTER TABLE sp_action ADD COLUMN external_ref VARCHAR(512); CREATE INDEX sp_idx_action_external_ref ON sp_action (external_ref); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_14__add_sha256_hash___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_14__add_sha256_hash___MYSQL.sql index bfe56f337..ca7e53fce 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_14__add_sha256_hash___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_14__add_sha256_hash___MYSQL.sql @@ -1,2 +1 @@ -ALTER TABLE sp_artifact - ADD COLUMN sha256_hash CHAR(64); \ No newline at end of file +ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_15__add_weight___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_15__add_weight___MYSQL.sql index 12db78a80..9eaad20e1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_15__add_weight___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_15__add_weight___MYSQL.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_action - ADD weight INT; -ALTER TABLE sp_rollout - ADD weight INT; -ALTER TABLE sp_target_filter_query - ADD auto_assign_weight INT; +ALTER TABLE sp_action ADD weight INT; +ALTER TABLE sp_rollout ADD weight INT; +ALTER TABLE sp_target_filter_query ADD auto_assign_weight INT; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_16__add_action_initiated_by___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_16__add_action_initiated_by___MYSQL.sql index 9461e26a2..d0b559b61 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_16__add_action_initiated_by___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_16__add_action_initiated_by___MYSQL.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_action - ADD COLUMN initiated_by VARCHAR(64) NOT NULL; -ALTER TABLE sp_target_filter_query - ADD COLUMN auto_assign_initiated_by VARCHAR(64); +ALTER TABLE sp_action ADD COLUMN initiated_by VARCHAR(64) NOT NULL; +ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_initiated_by VARCHAR(64); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_19__add_valid_flag_to_ds___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_19__add_valid_flag_to_ds___MYSQL.sql index 352419711..3ab0e7502 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_19__add_valid_flag_to_ds___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_19__add_valid_flag_to_ds___MYSQL.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_distribution_set - ADD COLUMN valid BOOLEAN; +ALTER TABLE sp_distribution_set ADD COLUMN valid BOOLEAN; -UPDATE sp_distribution_set -SET valid = 1; \ No newline at end of file +UPDATE sp_distribution_set SET valid = 1; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_1__missing_non_null___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_1__missing_non_null___MYSQL.sql index c540a3eec..deb2ab79d 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_1__missing_non_null___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_1__missing_non_null___MYSQL.sql @@ -1,4 +1,4 @@ -ALTER TABLE sp_action_status_messages CHANGE COLUMN detail_message detail_message varchar (512) not null; +ALTER TABLE sp_action_status_messages CHANGE COLUMN detail_message detail_message varchar(512) not null; ALTER TABLE sp_action CHANGE COLUMN distribution_set distribution_set bigint not null; ALTER TABLE sp_action CHANGE COLUMN target target bigint not null; ALTER TABLE sp_action CHANGE COLUMN status status integer not null; @@ -8,5 +8,5 @@ ALTER TABLE sp_rollout CHANGE COLUMN distribution_set distribution_set bigint no ALTER TABLE sp_rollout CHANGE COLUMN status status integer not null; ALTER TABLE sp_rolloutgroup CHANGE COLUMN rollout rollout bigint not null; ALTER TABLE sp_rolloutgroup CHANGE COLUMN status status integer not null; -ALTER TABLE sp_artifact CHANGE COLUMN sha1_hash sha1_hash varchar (40) not null; -ALTER TABLE sp_target CHANGE COLUMN controller_id controller_id varchar (64) not null; \ No newline at end of file +ALTER TABLE sp_artifact CHANGE COLUMN sha1_hash sha1_hash varchar(40) not null; +ALTER TABLE sp_target CHANGE COLUMN controller_id controller_id varchar(64) not null; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_20__add_encryption_flag_to_sm___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_20__add_encryption_flag_to_sm___MYSQL.sql index 5dd518204..9249d14a1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_20__add_encryption_flag_to_sm___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_20__add_encryption_flag_to_sm___MYSQL.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_base_software_module - ADD COLUMN encrypted BOOLEAN; +ALTER TABLE sp_base_software_module ADD COLUMN encrypted BOOLEAN; -UPDATE sp_base_software_module -SET encrypted = 0; \ No newline at end of file +UPDATE sp_base_software_module SET encrypted = 0; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_22__change_target_type_name_length___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_22__change_target_type_name_length___MYSQL.sql index 152eedc79..39c4c5965 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_22__change_target_type_name_length___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_22__change_target_type_name_length___MYSQL.sql @@ -1 +1 @@ -ALTER TABLE sp_target_type MODIFY name VARCHAR (128); \ No newline at end of file +ALTER TABLE sp_target_type MODIFY name VARCHAR(128); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_23__add_action_status_code___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_23__add_action_status_code___MYSQL.sql index c8573eab7..b5640ddec 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_23__add_action_status_code___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_23__add_action_status_code___MYSQL.sql @@ -1,3 +1,2 @@ -ALTER TABLE sp_action_status - ADD COLUMN code integer; +ALTER TABLE sp_action_status ADD COLUMN code integer; CREATE INDEX sp_idx_action_status_03 ON sp_action_status (tenant, code); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_24__add_last_action_status_code___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_24__add_last_action_status_code___MYSQL.sql index 253c8a5d4..03539efb3 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_24__add_last_action_status_code___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_24__add_last_action_status_code___MYSQL.sql @@ -1,2 +1 @@ -ALTER TABLE sp_action - ADD COLUMN last_action_status_code integer; \ No newline at end of file +ALTER TABLE sp_action ADD COLUMN last_action_status_code integer; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_25__add_confirmation_flag___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_25__add_confirmation_flag___MYSQL.sql index c8a38cf00..e8a7594c7 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_25__add_confirmation_flag___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_25__add_confirmation_flag___MYSQL.sql @@ -1,25 +1,21 @@ -ALTER TABLE sp_rolloutgroup - ADD column confirmation_required BOOLEAN; -UPDATE sp_rolloutgroup -SET confirmation_required = 0; +ALTER TABLE sp_rolloutgroup ADD column confirmation_required BOOLEAN; +UPDATE sp_rolloutgroup SET confirmation_required = 0; -ALTER TABLE sp_target_filter_query - ADD column confirmation_required BOOLEAN; -UPDATE sp_target_filter_query -SET confirmation_required = 0; +ALTER TABLE sp_target_filter_query ADD column confirmation_required BOOLEAN; +UPDATE sp_target_filter_query SET confirmation_required = 0; create table sp_target_conf_status ( - id bigint not null auto_increment, - target_id bigint not null, - initiator varchar(64), - remark varchar(512), - created_at bigint, - created_by varchar(64), - last_modified_at bigint, - last_modified_by varchar(64), - optlock_revision bigint, - tenant varchar(40) not null, + id bigint not null auto_increment, + target_id bigint not null, + initiator varchar(64), + remark varchar(512), + created_at bigint, + created_by varchar(64), + last_modified_at bigint, + last_modified_by varchar(64), + optlock_revision bigint, + tenant varchar(40) not null, primary key (id) ); ALTER TABLE sp_target_conf_status diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_26__add_access_control_context___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_26__add_access_control_context___MYSQL.sql index fb06922c7..ccf16963e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_26__add_access_control_context___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_26__add_access_control_context___MYSQL.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_target_filter_query - ADD COLUMN access_control_context VARCHAR(4096); -ALTER TABLE sp_rollout - ADD COLUMN access_control_context VARCHAR(4096); \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD COLUMN access_control_context VARCHAR(4096); +ALTER TABLE sp_rollout ADD COLUMN access_control_context VARCHAR(4096); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_27__target_type_inherit_type___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_27__target_type_inherit_type___MYSQL.sql index 2b63926eb..86e3350b8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_27__target_type_inherit_type___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_27__target_type_inherit_type___MYSQL.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_target_type - ADD COLUMN type_key VARCHAR(64) NOT NULL DEFAULT ('_'); -UPDATE sp_target_type -SET type_key = name; -ALTER TABLE sp_target_type - ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file +ALTER TABLE sp_target_type ADD COLUMN type_key VARCHAR (64) NOT NULL DEFAULT ('_'); +UPDATE sp_target_type SET type_key = name; +ALTER TABLE sp_target_type ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_28__add_dynamic_rollout___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_28__add_dynamic_rollout___MYSQL.sql index 6b6e3c2e2..030727a57 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_28__add_dynamic_rollout___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_28__add_dynamic_rollout___MYSQL.sql @@ -1,17 +1,9 @@ -ALTER TABLE sp_rollout - ADD COLUMN is_dynamic BOOLEAN; -ALTER TABLE sp_rolloutgroup - ADD COLUMN is_dynamic BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE sp_rollout ADD COLUMN is_dynamic BOOLEAN; +ALTER TABLE sp_rolloutgroup ADD COLUMN is_dynamic BOOLEAN NOT NULL DEFAULT false; -UPDATE sp_rollout -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_action -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_target_filter_query -SET auto_assign_weight = 1000 -WHERE auto_assign_weight IS NULL; +UPDATE sp_rollout SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_action SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_target_filter_query SET auto_assign_weight = 1000 WHERE auto_assign_weight IS NULL; ALTER TABLE sp_rollout MODIFY COLUMN weight INT NOT NULL; ALTER TABLE sp_action MODIFY COLUMN weight INT NOT NULL; ALTER TABLE sp_target_filter_query MODIFY COLUMN auto_assign_weight INT NOT NULL; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_29__add_ds_sm_locked___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_29__add_ds_sm_locked___MYSQL.sql index 831528f40..c5c0de6fb 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_29__add_ds_sm_locked___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_29__add_ds_sm_locked___MYSQL.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_base_software_module - ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; -ALTER TABLE sp_distribution_set - ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; \ No newline at end of file +ALTER TABLE sp_base_software_module ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; +ALTER TABLE sp_distribution_set ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_4__add_maintenance_window___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_4__add_maintenance_window___MYSQL.sql index 9c817454f..6c546cede 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_4__add_maintenance_window___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_4__add_maintenance_window___MYSQL.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_action - ADD column maintenance_cron_schedule VARCHAR(40); -ALTER TABLE sp_action - ADD column maintenance_duration VARCHAR(40); -ALTER TABLE sp_action - ADD column maintenance_time_zone VARCHAR(40); +ALTER TABLE sp_action ADD column maintenance_cron_schedule VARCHAR(40); +ALTER TABLE sp_action ADD column maintenance_duration VARCHAR(40); +ALTER TABLE sp_action ADD column maintenance_time_zone VARCHAR(40); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_6__add_index___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_6__add_index___MYSQL.sql index 9fdbca2f8..d7d7d6cc7 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_6__add_index___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_6__add_index___MYSQL.sql @@ -1,2 +1,2 @@ -CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name); +CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name); CREATE INDEX sp_idx_distribution_set_tag_01 ON sp_distributionset_tag (tenant, name); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_7__add_rollout_approval_fields___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_7__add_rollout_approval_fields___MYSQL.sql index 3e8138835..8438d909e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_7__add_rollout_approval_fields___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_7__add_rollout_approval_fields___MYSQL.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_rollout - ADD column approval_decided_by varchar(40); -ALTER TABLE sp_rollout - ADD column approval_remark varchar(255); \ No newline at end of file +ALTER TABLE sp_rollout ADD column approval_decided_by varchar(40); +ALTER TABLE sp_rollout ADD column approval_remark varchar(255); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_8__change_length_of_created_last_modified_by___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_8__change_length_of_created_last_modified_by___MYSQL.sql index 5093f8854..283fdf2c9 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_8__change_length_of_created_last_modified_by___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_8__change_length_of_created_last_modified_by___MYSQL.sql @@ -1,29 +1,29 @@ -ALTER TABLE sp_action MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_action MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_action_status MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_action_status MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_artifact MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_artifact MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_base_software_module MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_base_software_module MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_distributionset_tag MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_distributionset_tag MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_distribution_set MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_distribution_set MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_distribution_set_type MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_distribution_set_type MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_rollout MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64), MODIFY approval_decided_by VARCHAR (64); +ALTER TABLE sp_rollout MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64), MODIFY approval_decided_by VARCHAR(64); -ALTER TABLE sp_rolloutgroup MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_rolloutgroup MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_software_module_type MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_software_module_type MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_target MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_target MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_target_filter_query MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_target_filter_query MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_target_tag MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_target_tag MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_tenant MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); +ALTER TABLE sp_tenant MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); -ALTER TABLE sp_tenant_configuration MODIFY created_by VARCHAR (64), MODIFY last_modified_by VARCHAR (64); \ No newline at end of file +ALTER TABLE sp_tenant_configuration MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_9__add_target_metadata___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_9__add_target_metadata___MYSQL.sql index 8e17215ce..3b1be5e4b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_9__add_target_metadata___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_12_9__add_target_metadata___MYSQL.sql @@ -1,13 +1,12 @@ -create table sp_target_metadata -( - meta_key varchar(128) not null, - meta_value varchar(4000), - target_id bigint not null, - primary key (target_id, meta_key) +create table sp_target_metadata ( + meta_key varchar(128) not null, + meta_value varchar(4000), + target_id bigint not null, + primary key (target_id, meta_key) ); - -alter table sp_target_metadata - add constraint fk_metadata_target - foreign key (target_id) - references sp_target (id) - on delete cascade; \ No newline at end of file + +alter table sp_target_metadata + add constraint fk_metadata_target + foreign key (target_id) + references sp_target (id) + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_2_0__update_target_info_for_message___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_2_0__update_target_info_for_message___MYSQL.sql index ac2792156..84f37aed8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_2_0__update_target_info_for_message___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_2_0__update_target_info_for_message___MYSQL.sql @@ -1,8 +1,8 @@ DROP INDEX sp_idx_target_info_01 ON sp_target_info; ALTER TABLE sp_target_info - CHANGE ip_address address VARCHAR (512); +CHANGE ip_address address VARCHAR(512); UPDATE sp_target_info t1, sp_target_info t2 -SET t1.address = CONCAT('http://', t2.address) +SET t1.address = CONCAT('http://',t2.address) WHERE t1.target_id = t2.target_id AND t2.address is not null \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_4_0__cascade_delete___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_4_0__cascade_delete___MYSQL.sql index f7bf3ad8b..a96f76dcb 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_4_0__cascade_delete___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_4_0__cascade_delete___MYSQL.sql @@ -1,73 +1,73 @@ alter table sp_target_info drop FOREIGN KEY fk_targ_stat_targ; -alter table sp_target_info - add constraint fk_targ_stat_targ - foreign key (target_id) - references sp_target (id) - on delete cascade; +alter table sp_target_info + add constraint fk_targ_stat_targ + foreign key (target_id) + references sp_target (id) + on delete cascade; alter table sp_action drop FOREIGN KEY fk_targ_act_hist_targ; alter table sp_action drop index fk_targ_act_hist_targ; -alter table sp_action - add constraint fk_targ_act_hist_targ - foreign key (target) - references sp_target (id) - on delete cascade; +alter table sp_action + add constraint fk_targ_act_hist_targ + foreign key (target) + references sp_target (id) + on delete cascade; alter table sp_action_status drop FOREIGN KEY fk_act_stat_action; -alter table sp_action_status drop index fk_act_stat_action; -alter table sp_action_status - add constraint fk_act_stat_action - foreign key (action) - references sp_action (id) - on delete cascade; +alter table sp_action_status drop index fk_act_stat_action; +alter table sp_action_status + add constraint fk_act_stat_action + foreign key (action) + references sp_action (id) + on delete cascade; alter table sp_sw_metadata drop FOREIGN KEY fk_metadata_sw; alter table sp_sw_metadata drop index fk_metadata_sw; -alter table sp_sw_metadata - add constraint fk_metadata_sw - foreign key (sw_id) - references sp_base_software_module (id) - on delete cascade; +alter table sp_sw_metadata + add constraint fk_metadata_sw + foreign key (sw_id) + references sp_base_software_module (id) + on delete cascade; -alter table sp_ds_metadata drop FOREIGN KEY fk_metadata_ds; -alter table sp_ds_metadata - add constraint fk_metadata_ds - foreign key (ds_id) - references sp_distribution_set (id) - on delete cascade; +alter table sp_ds_metadata drop FOREIGN KEY fk_metadata_ds; +alter table sp_ds_metadata + add constraint fk_metadata_ds + foreign key (ds_id) + references sp_distribution_set (id) + on delete cascade; -alter table sp_action_status_messages drop FOREIGN KEY fk_stat_msg_act_stat; -alter table sp_action_status_messages - add constraint fk_stat_msg_act_stat - foreign key (action_status_id) - references sp_action_status (id) - on delete cascade; +alter table sp_action_status_messages drop FOREIGN KEY fk_stat_msg_act_stat; +alter table sp_action_status_messages + add constraint fk_stat_msg_act_stat + foreign key (action_status_id) + references sp_action_status (id) + on delete cascade; alter table sp_ds_dstag drop FOREIGN KEY fk_ds_dstag_tag; alter table sp_ds_dstag drop index fk_ds_dstag_tag; -alter table sp_ds_dstag - add constraint fk_ds_dstag_tag - foreign key (TAG) - references sp_distributionset_tag (id) - on delete cascade; +alter table sp_ds_dstag + add constraint fk_ds_dstag_tag + foreign key (TAG) + references sp_distributionset_tag (id) + on delete cascade; alter table sp_ds_dstag drop FOREIGN KEY fk_ds_dstag_ds; -alter table sp_ds_dstag - add constraint fk_ds_dstag_ds - foreign key (ds) - references sp_distribution_set (id) - on delete cascade; +alter table sp_ds_dstag + add constraint fk_ds_dstag_ds + foreign key (ds) + references sp_distribution_set (id) + on delete cascade; alter table sp_target_target_tag drop FOREIGN KEY fk_targ_targtag_tag; -alter table sp_target_target_tag - add constraint fk_targ_targtag_tag - foreign key (tag) - references sp_target_tag (id) - on delete cascade; +alter table sp_target_target_tag + add constraint fk_targ_targtag_tag + foreign key (tag) + references sp_target_tag (id) + on delete cascade; alter table sp_target_target_tag drop FOREIGN KEY fk_targ_targtag_target; -alter table sp_target_target_tag - add constraint fk_targ_targtag_target - foreign key (target) - references sp_target (id) - on delete cascade; \ No newline at end of file +alter table sp_target_target_tag + add constraint fk_targ_targtag_target + foreign key (target) + references sp_target (id) + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_4_1__cascade_delete___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_4_1__cascade_delete___MYSQL.sql index d507739ec..e1ba9ec74 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_4_1__cascade_delete___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_4_1__cascade_delete___MYSQL.sql @@ -1,6 +1,6 @@ alter table sp_target_attributes drop FOREIGN KEY fk_targ_attrib_target; -alter table sp_target_attributes - add constraint fk_targ_attrib_target - foreign key (target_id) - references sp_target_info (target_id) - on delete cascade; \ No newline at end of file +alter table sp_target_attributes + add constraint fk_targ_attrib_target + foreign key (target_id) + references sp_target_info (target_id) + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_5_0__target_filter_query___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_5_0__target_filter_query___MYSQL.sql index ef41368f6..590329345 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_5_0__target_filter_query___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_5_0__target_filter_query___MYSQL.sql @@ -1,16 +1,15 @@ -create table sp_target_filter_query -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - name varchar(64) not null, - query varchar(1024) not null, - primary key (id) -); - - -create index sp_idx_target_filter_query_01 on sp_target_filter_query (tenant, name); + create table sp_target_filter_query ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + name varchar(64) not null, + query varchar(1024) not null, + primary key (id) + ); + + + create index sp_idx_target_filter_query_01 on sp_target_filter_query (tenant, name); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_6_0__rollout_management___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_6_0__rollout_management___MYSQL.sql index 5c5122939..4cd4c7ea4 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_6_0__rollout_management___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_6_0__rollout_management___MYSQL.sql @@ -1,108 +1,103 @@ -create table sp_rolloutgroup -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - error_condition integer, - error_condition_exp varchar(512), - error_action integer, - error_action_exp varchar(512), - success_condition integer not null, - success_condition_exp varchar(512) not null, - success_action integer not null, - success_action_exp varchar(512), - status integer, - parent_id bigint, - rollout bigint, - total_targets bigint, - primary key (id) -); + create table sp_rolloutgroup ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + error_condition integer, + error_condition_exp varchar(512), + error_action integer, + error_action_exp varchar(512), + success_condition integer not null, + success_condition_exp varchar(512) not null, + success_action integer not null, + success_action_exp varchar(512), + status integer, + parent_id bigint, + rollout bigint, + total_targets bigint, + primary key (id) + ); + + create table sp_rollout ( + id bigint not null auto_increment, + created_at bigint, + created_by varchar(40), + last_modified_at bigint, + last_modified_by varchar(40), + optlock_revision bigint, + tenant varchar(40) not null, + description varchar(512), + name varchar(64) not null, + last_check bigint, + group_theshold float, + status integer, + distribution_set bigint, + target_filter varchar(1024), + action_type varchar(255) not null, + forced_time bigint, + total_targets bigint, + primary key (id) + ); + + create table sp_rollouttargetgroup ( + target_Id bigint not null, + rolloutGroup_Id bigint not null, + primary key (rolloutGroup_Id, target_Id) + ); + + create index sp_idx_rollout_01 on sp_rollout (tenant, name); + + create index sp_idx_rolloutgroup_01 on sp_rolloutgroup (tenant, name); + + ALTER TABLE sp_action ADD COLUMN rollout bigint; + ALTER TABLE sp_action ADD COLUMN rolloutgroup bigint; + + alter table sp_rollout + add constraint uk_rollout unique (name, tenant); + + alter table sp_rolloutgroup + add constraint uk_rolloutgroup unique (name, rollout, tenant); + + alter table sp_action + add constraint fk_action_rollout + foreign key (rollout) + references sp_rollout (id); + + alter table sp_action + add constraint fk_action_rolloutgroup + foreign key (rolloutgroup) + references sp_rolloutgroup (id); + + alter table sp_rollout + add constraint fk_rollout_ds + foreign key (distribution_set) + references sp_distribution_set (id); -create table sp_rollout -( - id bigint not null auto_increment, - created_at bigint, - created_by varchar(40), - last_modified_at bigint, - last_modified_by varchar(40), - optlock_revision bigint, - tenant varchar(40) not null, - description varchar(512), - name varchar(64) not null, - last_check bigint, - group_theshold float, - status integer, - distribution_set bigint, - target_filter varchar(1024), - action_type varchar(255) not null, - forced_time bigint, - total_targets bigint, - primary key (id) -); + alter table sp_rolloutgroup + add constraint fk_rolloutgroup_rollout + foreign key (rollout) + references sp_rollout (id) + on delete cascade; + + alter table sp_rolloutgroup + add constraint fk_rolloutgroup_rolloutgroup + foreign key (parent_id) + references sp_rolloutgroup (id) + on delete cascade; + + alter table sp_rollouttargetgroup + add constraint fk_rollouttargetgroup_target + foreign key (target_id) + references sp_target (id) + on delete cascade; -create table sp_rollouttargetgroup -( - target_Id bigint not null, - rolloutGroup_Id bigint not null, - primary key (rolloutGroup_Id, target_Id) -); - -create index sp_idx_rollout_01 on sp_rollout (tenant, name); - -create index sp_idx_rolloutgroup_01 on sp_rolloutgroup (tenant, name); - -ALTER TABLE sp_action - ADD COLUMN rollout bigint; -ALTER TABLE sp_action - ADD COLUMN rolloutgroup bigint; - -alter table sp_rollout - add constraint uk_rollout unique (name, tenant); - -alter table sp_rolloutgroup - add constraint uk_rolloutgroup unique (name, rollout, tenant); - -alter table sp_action - add constraint fk_action_rollout - foreign key (rollout) - references sp_rollout (id); - -alter table sp_action - add constraint fk_action_rolloutgroup - foreign key (rolloutgroup) - references sp_rolloutgroup (id); - -alter table sp_rollout - add constraint fk_rollout_ds - foreign key (distribution_set) - references sp_distribution_set (id); - -alter table sp_rolloutgroup - add constraint fk_rolloutgroup_rollout - foreign key (rollout) - references sp_rollout (id) - on delete cascade; - -alter table sp_rolloutgroup - add constraint fk_rolloutgroup_rolloutgroup - foreign key (parent_id) - references sp_rolloutgroup (id) - on delete cascade; - -alter table sp_rollouttargetgroup - add constraint fk_rollouttargetgroup_target - foreign key (target_id) - references sp_target (id) - on delete cascade; - -alter table sp_rollouttargetgroup - add constraint fk_rollouttargetgroup_rolloutgroup - foreign key (rolloutgroup_id) - references sp_rolloutgroup (id) - on delete cascade; \ No newline at end of file + alter table sp_rollouttargetgroup + add constraint fk_rollouttargetgroup_rolloutgroup + foreign key (rolloutgroup_id) + references sp_rolloutgroup (id) + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_7_0__swmType_maxAssignment_greater_0__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_7_0__swmType_maxAssignment_greater_0__MYSQL.sql index 75766d9dc..f79c9375c 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_7_0__swmType_maxAssignment_greater_0__MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_7_0__swmType_maxAssignment_greater_0__MYSQL.sql @@ -1,3 +1 @@ -Update sp_software_module_type -set max_ds_assignments = 1 -where max_ds_assignments < 1; \ No newline at end of file +Update sp_software_module_type set max_ds_assignments = 1 where max_ds_assignments < 1; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_7_1__reduce_length_enums___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_7_1__reduce_length_enums___MYSQL.sql index 4a342472e..ae9eef28e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_7_1__reduce_length_enums___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_7_1__reduce_length_enums___MYSQL.sql @@ -1,5 +1,5 @@ -ALTER TABLE sp_target_info MODIFY update_status VARCHAR (16) not null; -ALTER TABLE sp_action MODIFY action_type VARCHAR (16) not null; -ALTER TABLE sp_rollout MODIFY action_type VARCHAR (16) not null; -ALTER TABLE sp_tenant_configuration MODIFY conf_key VARCHAR (128) not null; -ALTER TABLE sp_tenant_configuration MODIFY conf_value VARCHAR (512) not null; \ No newline at end of file +ALTER TABLE sp_target_info MODIFY update_status VARCHAR(16) not null; +ALTER TABLE sp_action MODIFY action_type VARCHAR(16) not null; +ALTER TABLE sp_rollout MODIFY action_type VARCHAR(16) not null; +ALTER TABLE sp_tenant_configuration MODIFY conf_key VARCHAR(128) not null; +ALTER TABLE sp_tenant_configuration MODIFY conf_value VARCHAR(512) not null; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_8_0__auto_assign_ds_filter__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_8_0__auto_assign_ds_filter__MYSQL.sql index d6ea40ccc..e56a6d242 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_8_0__auto_assign_ds_filter__MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_8_0__auto_assign_ds_filter__MYSQL.sql @@ -1,8 +1,8 @@ ALTER TABLE sp_target_filter_query - ADD COLUMN auto_assign_distribution_set BIGINT; + ADD COLUMN auto_assign_distribution_set BIGINT; ALTER TABLE sp_target_filter_query - ADD CONSTRAINT fk_filter_auto_assign_ds - FOREIGN KEY (auto_assign_distribution_set) - REFERENCES sp_distribution_set (id) - ON DELETE SET NULL; + ADD CONSTRAINT fk_filter_auto_assign_ds +FOREIGN KEY (auto_assign_distribution_set) +REFERENCES sp_distribution_set (id) +ON DELETE SET NULL; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_8_1__cascade_delete___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_8_1__cascade_delete___MYSQL.sql index 5c11fb7ab..9cc12b375 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_8_1__cascade_delete___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_8_1__cascade_delete___MYSQL.sql @@ -1,27 +1,27 @@ alter table sp_ds_module drop FOREIGN KEY fk_ds_module_ds; -alter table sp_ds_module - add constraint fk_ds_module_ds - foreign key (ds_id) - references sp_distribution_set (id) - on delete cascade; +alter table sp_ds_module + add constraint fk_ds_module_ds + foreign key (ds_id) + references sp_distribution_set (id) + on delete cascade; alter table sp_ds_module drop FOREIGN KEY fk_ds_module_module; -alter table sp_ds_module - add constraint fk_ds_module_module - foreign key (module_id) - references sp_base_software_module (id) - on delete cascade; +alter table sp_ds_module + add constraint fk_ds_module_module + foreign key (module_id) + references sp_base_software_module (id) + on delete cascade; alter table sp_external_artifact drop FOREIGN KEY fk_external_assigned_sm; -alter table sp_external_artifact - add constraint fk_external_assigned_sm - foreign key (software_module) - references sp_base_software_module (id) - on delete cascade; +alter table sp_external_artifact + add constraint fk_external_assigned_sm + foreign key (software_module) + references sp_base_software_module (id) + on delete cascade; alter table sp_artifact drop FOREIGN KEY fk_assigned_sm; -alter table sp_artifact - add constraint fk_assigned_sm - foreign key (software_module) - references sp_base_software_module (id) - on delete cascade; \ No newline at end of file +alter table sp_artifact + add constraint fk_assigned_sm + foreign key (software_module) + references sp_base_software_module (id) + on delete cascade; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_9_0__add_rollout_groups_created___MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_9_0__add_rollout_groups_created___MYSQL.sql index bbcd2d6af..64518f762 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_9_0__add_rollout_groups_created___MYSQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/MYSQL/V1_9_0__add_rollout_groups_created___MYSQL.sql @@ -1,3 +1,2 @@ -ALTER TABLE sp_rollout - ADD column rollout_groups_created BIGINT; + ALTER TABLE sp_rollout ADD column rollout_groups_created BIGINT; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_15__baseline___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_15__baseline___POSTGRESQL.sql index ab260ed75..ba8b988d6 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_15__baseline___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_15__baseline___POSTGRESQL.sql @@ -77,821 +77,796 @@ NO CYCLE; -- ------------ Write CREATE-TABLE-stage scripts ----------- -CREATE TABLE sp_action -( - id BIGINT NOT NULL DEFAULT nextval('sp_action_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - active BOOLEAN, - forced_time BIGINT, - status INTEGER NOT NULL, - distribution_set BIGINT NOT NULL, - target BIGINT NOT NULL, - rollout BIGINT, - rolloutgroup BIGINT, - action_type INTEGER NOT NULL, +CREATE TABLE sp_action( + id BIGINT NOT NULL DEFAULT nextval('sp_action_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + active BOOLEAN, + forced_time BIGINT, + status INTEGER NOT NULL, + distribution_set BIGINT NOT NULL, + target BIGINT NOT NULL, + rollout BIGINT, + rolloutgroup BIGINT, + action_type INTEGER NOT NULL, maintenance_cron_schedule VARCHAR(40), - maintenance_duration VARCHAR(40), - maintenance_time_zone VARCHAR(40), - external_ref VARCHAR(512), - weight INTEGER + maintenance_duration VARCHAR(40), + maintenance_time_zone VARCHAR(40), + external_ref VARCHAR(512), + weight INTEGER ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_action_status -( - id BIGINT NOT NULL DEFAULT nextval('sp_action_status_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - target_occurred_at BIGINT NOT NULL, - status INTEGER NOT NULL, - action BIGINT NOT NULL +CREATE TABLE sp_action_status( + id BIGINT NOT NULL DEFAULT nextval('sp_action_status_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + target_occurred_at BIGINT NOT NULL, + status INTEGER NOT NULL, + action BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_action_status_messages -( - action_status_id BIGINT NOT NULL, - detail_message VARCHAR(512) NOT NULL +CREATE TABLE sp_action_status_messages( + action_status_id BIGINT NOT NULL, + detail_message VARCHAR(512) NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_artifact -( - id BIGINT NOT NULL DEFAULT nextval('sp_artifact_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - md5_hash VARCHAR(32), - file_size BIGINT, +CREATE TABLE sp_artifact( + id BIGINT NOT NULL DEFAULT nextval('sp_artifact_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + md5_hash VARCHAR(32), + file_size BIGINT, provided_file_name VARCHAR(256), - sha1_hash VARCHAR(40) NOT NULL, - software_module BIGINT NOT NULL, - sha256_hash CHAR(64) + sha1_hash VARCHAR(40) NOT NULL, + software_module BIGINT NOT NULL, + sha256_hash CHAR(64) ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_base_software_module -( - id BIGINT NOT NULL DEFAULT nextval('sp_base_software_module_seq'), - created_at BIGINT, - created_by VARCHAR(64), +CREATE TABLE sp_base_software_module( + id BIGINT NOT NULL DEFAULT nextval('sp_base_software_module_seq'), + created_at BIGINT, + created_by VARCHAR(64), last_modified_at BIGINT, last_modified_by VARCHAR(64), optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - version VARCHAR(64) NOT NULL, - deleted BOOLEAN, - vendor VARCHAR(256), - module_type BIGINT NOT NULL + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + version VARCHAR(64) NOT NULL, + deleted BOOLEAN, + vendor VARCHAR(256), + module_type BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_distribution_set -( - id BIGINT NOT NULL DEFAULT nextval('sp_distribution_set_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - version VARCHAR(64) NOT NULL, - complete BOOLEAN, - deleted BOOLEAN, +CREATE TABLE sp_distribution_set( + id BIGINT NOT NULL DEFAULT nextval('sp_distribution_set_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + version VARCHAR(64) NOT NULL, + complete BOOLEAN, + deleted BOOLEAN, required_migration_step BOOLEAN, - ds_id BIGINT NOT NULL + ds_id BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_distribution_set_type -( - id BIGINT NOT NULL DEFAULT nextval('sp_distribution_set_type_seq'), - created_at BIGINT, - created_by VARCHAR(64), +CREATE TABLE sp_distribution_set_type( + id BIGINT NOT NULL DEFAULT nextval('sp_distribution_set_type_seq'), + created_at BIGINT, + created_by VARCHAR(64), last_modified_at BIGINT, last_modified_by VARCHAR(64), optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - colour VARCHAR(16), - deleted BOOLEAN, - type_key VARCHAR(64) NOT NULL + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + colour VARCHAR(16), + deleted BOOLEAN, + type_key VARCHAR(64) NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_distributionset_tag -( - id BIGINT NOT NULL DEFAULT nextval('sp_distributionset_tag_seq'), - created_at BIGINT, - created_by VARCHAR(64), +CREATE TABLE sp_distributionset_tag( + id BIGINT NOT NULL DEFAULT nextval('sp_distributionset_tag_seq'), + created_at BIGINT, + created_by VARCHAR(64), last_modified_at BIGINT, last_modified_by VARCHAR(64), optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - colour VARCHAR(16) + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + colour VARCHAR(16) ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_ds_dstag -( - ds BIGINT NOT NULL, +CREATE TABLE sp_ds_dstag( + ds BIGINT NOT NULL, tag BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_ds_metadata -( - meta_key VARCHAR(128) NOT NULL, +CREATE TABLE sp_ds_metadata( + meta_key VARCHAR(128) NOT NULL, meta_value VARCHAR(4000), - ds_id BIGINT NOT NULL + ds_id BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_ds_module -( - ds_id BIGINT NOT NULL, +CREATE TABLE sp_ds_module( + ds_id BIGINT NOT NULL, module_id BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_ds_type_element -( - mandatory BOOLEAN, +CREATE TABLE sp_ds_type_element( + mandatory BOOLEAN, distribution_set_type BIGINT NOT NULL, - software_module_type BIGINT NOT NULL + software_module_type BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_rollout -( - id BIGINT NOT NULL DEFAULT nextval('sp_rollout_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - last_check BIGINT, - group_theshold REAL, - status INTEGER NOT NULL, - distribution_set BIGINT NOT NULL, - target_filter VARCHAR(1024), - forced_time BIGINT, - total_targets BIGINT, +CREATE TABLE sp_rollout( + id BIGINT NOT NULL DEFAULT nextval('sp_rollout_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + last_check BIGINT, + group_theshold REAL, + status INTEGER NOT NULL, + distribution_set BIGINT NOT NULL, + target_filter VARCHAR(1024), + forced_time BIGINT, + total_targets BIGINT, rollout_groups_created BIGINT, - start_at BIGINT, - deleted BOOLEAN, - action_type INTEGER NOT NULL, - approval_decided_by VARCHAR(64), - approval_remark VARCHAR(255), - weight INTEGER + start_at BIGINT, + deleted BOOLEAN, + action_type INTEGER NOT NULL, + approval_decided_by VARCHAR(64), + approval_remark VARCHAR(255), + weight INTEGER ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_rolloutgroup -( - id BIGINT NOT NULL DEFAULT nextval('sp_rolloutgroup_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - error_condition INTEGER, - error_condition_exp VARCHAR(512), - error_action INTEGER, - error_action_exp VARCHAR(512), - success_condition INTEGER NOT NULL, +CREATE TABLE sp_rolloutgroup( + id BIGINT NOT NULL DEFAULT nextval('sp_rolloutgroup_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + error_condition INTEGER, + error_condition_exp VARCHAR(512), + error_action INTEGER, + error_action_exp VARCHAR(512), + success_condition INTEGER NOT NULL, success_condition_exp VARCHAR(512) NOT NULL, - success_action INTEGER NOT NULL, - success_action_exp VARCHAR(512), - status INTEGER NOT NULL, - parent_id BIGINT, - rollout BIGINT NOT NULL, - total_targets BIGINT, - target_percentage REAL, - target_filter VARCHAR(1024) + success_action INTEGER NOT NULL, + success_action_exp VARCHAR(512), + status INTEGER NOT NULL, + parent_id BIGINT, + rollout BIGINT NOT NULL, + total_targets BIGINT, + target_percentage REAL, + target_filter VARCHAR(1024) ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_rollouttargetgroup -( - target_id BIGINT NOT NULL, +CREATE TABLE sp_rollouttargetgroup( + target_id BIGINT NOT NULL, rolloutgroup_id BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_software_module_type -( - id BIGINT NOT NULL DEFAULT nextval('sp_software_module_type_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - colour VARCHAR(16), - deleted BOOLEAN, - type_key VARCHAR(64) NOT NULL, - max_ds_assignments INTEGER NOT NULL +CREATE TABLE sp_software_module_type( + id BIGINT NOT NULL DEFAULT nextval('sp_software_module_type_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + colour VARCHAR(16), + deleted BOOLEAN, + type_key VARCHAR(64) NOT NULL, + max_ds_assignments INTEGER NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_sw_metadata -( - meta_key VARCHAR(128) NOT NULL, - meta_value VARCHAR(4000), - sw_id BIGINT NOT NULL, +CREATE TABLE sp_sw_metadata( + meta_key VARCHAR(128) NOT NULL, + meta_value VARCHAR(4000), + sw_id BIGINT NOT NULL, target_visible BOOLEAN ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_target -( - id BIGINT NOT NULL DEFAULT nextval('sp_target_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - controller_id VARCHAR(256), - sec_token VARCHAR(128) NOT NULL, - assigned_distribution_set BIGINT, - install_date BIGINT, - address VARCHAR(512), - last_target_query BIGINT, - request_controller_attributes BOOLEAN NOT NULL, - installed_distribution_set BIGINT, - update_status INTEGER NOT NULL +CREATE TABLE sp_target( + id BIGINT NOT NULL DEFAULT nextval('sp_target_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + controller_id VARCHAR(256), + sec_token VARCHAR(128) NOT NULL, + assigned_distribution_set BIGINT, + install_date BIGINT, + address VARCHAR(512), + last_target_query BIGINT, + request_controller_attributes BOOLEAN NOT NULL, + installed_distribution_set BIGINT, + update_status INTEGER NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_target_attributes -( - target_id BIGINT NOT NULL, +CREATE TABLE sp_target_attributes( + target_id BIGINT NOT NULL, attribute_value VARCHAR(128), - attribute_key VARCHAR(128) NOT NULL + attribute_key VARCHAR(128) NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_target_filter_query -( - id BIGINT NOT NULL DEFAULT nextval('sp_target_filter_query_seq'), - created_at BIGINT, - created_by VARCHAR(64), - last_modified_at BIGINT, - last_modified_by VARCHAR(64), - optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - name VARCHAR(128), - query VARCHAR(1024) NOT NULL, +CREATE TABLE sp_target_filter_query( + id BIGINT NOT NULL DEFAULT nextval('sp_target_filter_query_seq'), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + name VARCHAR(128), + query VARCHAR(1024) NOT NULL, auto_assign_distribution_set BIGINT, - auto_assign_action_type INTEGER, - auto_assign_weight INTEGER + auto_assign_action_type INTEGER, + auto_assign_weight INTEGER ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_target_metadata -( - meta_key VARCHAR(128) NOT NULL, +CREATE TABLE sp_target_metadata( + meta_key VARCHAR(128) NOT NULL, meta_value VARCHAR(4000), - target_id BIGINT NOT NULL + target_id BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_target_tag -( - id BIGINT NOT NULL DEFAULT nextval('sp_target_tag_seq'), - created_at BIGINT, - created_by VARCHAR(64), +CREATE TABLE sp_target_tag( + id BIGINT NOT NULL DEFAULT nextval('sp_target_tag_seq'), + created_at BIGINT, + created_by VARCHAR(64), last_modified_at BIGINT, last_modified_by VARCHAR(64), optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - description VARCHAR(512), - name VARCHAR(128), - colour VARCHAR(16) + tenant VARCHAR(40) NOT NULL, + description VARCHAR(512), + name VARCHAR(128), + colour VARCHAR(16) ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_target_target_tag -( +CREATE TABLE sp_target_target_tag( target BIGINT NOT NULL, - tag BIGINT NOT NULL + tag BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_tenant -( - id BIGINT NOT NULL DEFAULT nextval('sp_tenant_seq'), - created_at BIGINT, - created_by VARCHAR(64), +CREATE TABLE sp_tenant( + id BIGINT NOT NULL DEFAULT nextval('sp_tenant_seq'), + created_at BIGINT, + created_by VARCHAR(64), last_modified_at BIGINT, last_modified_by VARCHAR(64), optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - default_ds_type BIGINT NOT NULL + tenant VARCHAR(40) NOT NULL, + default_ds_type BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_tenant_configuration -( - id BIGINT NOT NULL DEFAULT nextval('sp_tenant_configuration_seq'), - created_at BIGINT, - created_by VARCHAR(64), +CREATE TABLE sp_tenant_configuration( + id BIGINT NOT NULL DEFAULT nextval('sp_tenant_configuration_seq'), + created_at BIGINT, + created_by VARCHAR(64), last_modified_at BIGINT, last_modified_by VARCHAR(64), optlock_revision BIGINT, - tenant VARCHAR(40) NOT NULL, - conf_key VARCHAR(128) NOT NULL, - conf_value VARCHAR(512) NOT NULL + tenant VARCHAR(40) NOT NULL, + conf_key VARCHAR(128) NOT NULL, + conf_value VARCHAR(512) NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -- ------------ Write CREATE-INDEX-stage scripts ----------- CREATE INDEX sp_idx_action_01_sp_action - ON sp_action - USING BTREE (tenant, distribution_set); +ON sp_action +USING BTREE (tenant, distribution_set); CREATE INDEX sp_idx_action_02_sp_action - ON sp_action - USING BTREE (tenant, target, active); +ON sp_action +USING BTREE (tenant, target, active); CREATE INDEX sp_idx_action_external_ref_sp_action - ON sp_action - USING BTREE (external_ref); +ON sp_action +USING BTREE (external_ref); CREATE INDEX sp_idx_action_prim_sp_action - ON sp_action - USING BTREE (tenant, id); +ON sp_action +USING BTREE (tenant, id); CREATE INDEX sp_idx_action_status_02_sp_action_status - ON sp_action_status - USING BTREE (tenant, action, status); +ON sp_action_status +USING BTREE (tenant, action, status); CREATE INDEX sp_idx_action_status_prim_sp_action_status - ON sp_action_status - USING BTREE (tenant, id); +ON sp_action_status +USING BTREE (tenant, id); CREATE INDEX sp_idx_action_status_msgs_01_sp_action_status_messages - ON sp_action_status_messages - USING BTREE (action_status_id); +ON sp_action_status_messages +USING BTREE (action_status_id); CREATE INDEX sp_idx_artifact_01_sp_artifact - ON sp_artifact - USING BTREE (tenant, software_module); +ON sp_artifact +USING BTREE (tenant, software_module); CREATE INDEX sp_idx_artifact_02_sp_artifact - ON sp_artifact - USING BTREE (tenant, sha1_hash); +ON sp_artifact +USING BTREE (tenant, sha1_hash); CREATE INDEX sp_idx_artifact_prim_sp_artifact - ON sp_artifact - USING BTREE (tenant, id); +ON sp_artifact +USING BTREE (tenant, id); CREATE INDEX sp_idx_base_sw_module_01_sp_base_software_module - ON sp_base_software_module - USING BTREE (tenant, deleted, name, version); +ON sp_base_software_module +USING BTREE (tenant, deleted, name, version); CREATE INDEX sp_idx_base_sw_module_02_sp_base_software_module - ON sp_base_software_module - USING BTREE (tenant, deleted, module_type); +ON sp_base_software_module +USING BTREE (tenant, deleted, module_type); CREATE INDEX sp_idx_base_sw_module_prim_sp_base_software_module - ON sp_base_software_module - USING BTREE (tenant, id); +ON sp_base_software_module +USING BTREE (tenant, id); CREATE INDEX sp_idx_distribution_set_01_sp_distribution_set - ON sp_distribution_set - USING BTREE (tenant, deleted, complete); +ON sp_distribution_set +USING BTREE (tenant, deleted, complete); CREATE INDEX sp_idx_distribution_set_prim_sp_distribution_set - ON sp_distribution_set - USING BTREE (tenant, id); +ON sp_distribution_set +USING BTREE (tenant, id); CREATE INDEX sp_idx_distribution_set_type_01_sp_distribution_set_type - ON sp_distribution_set_type - USING BTREE (tenant, deleted); +ON sp_distribution_set_type +USING BTREE (tenant, deleted); CREATE INDEX sp_idx_distribution_set_type_prim_sp_distribution_set_type - ON sp_distribution_set_type - USING BTREE (tenant, id); +ON sp_distribution_set_type +USING BTREE (tenant, id); CREATE INDEX sp_idx_distribution_set_tag_01_sp_distributionset_tag - ON sp_distributionset_tag - USING BTREE (tenant, name); +ON sp_distributionset_tag +USING BTREE (tenant, name); CREATE INDEX sp_idx_distribution_set_tag_prim_sp_distributionset_tag - ON sp_distributionset_tag - USING BTREE (tenant, id); +ON sp_distributionset_tag +USING BTREE (tenant, id); CREATE INDEX fk_rolloutgroup_rolloutgroup_sp_rolloutgroup - ON sp_rolloutgroup - USING BTREE (parent_id); +ON sp_rolloutgroup +USING BTREE (parent_id); CREATE INDEX sp_idx_software_module_type_01_sp_software_module_type - ON sp_software_module_type - USING BTREE (tenant, deleted); +ON sp_software_module_type +USING BTREE (tenant, deleted); CREATE INDEX sp_idx_software_module_type_prim_sp_software_module_type - ON sp_software_module_type - USING BTREE (tenant, id); +ON sp_software_module_type +USING BTREE (tenant, id); CREATE INDEX sp_idx_target_01_sp_target - ON sp_target - USING BTREE (tenant, name, assigned_distribution_set); +ON sp_target +USING BTREE (tenant, name, assigned_distribution_set); CREATE INDEX sp_idx_target_03_sp_target - ON sp_target - USING BTREE (tenant, controller_id, assigned_distribution_set); +ON sp_target +USING BTREE (tenant, controller_id, assigned_distribution_set); CREATE INDEX sp_idx_target_04_sp_target - ON sp_target - USING BTREE (tenant, created_at); +ON sp_target +USING BTREE (tenant, created_at); CREATE INDEX sp_idx_target_prim_sp_target - ON sp_target - USING BTREE (tenant, id); +ON sp_target +USING BTREE (tenant, id); CREATE INDEX sp_idx_target_tag_01_sp_target_tag - ON sp_target_tag - USING BTREE (tenant, name); +ON sp_target_tag +USING BTREE (tenant, name); CREATE INDEX sp_idx_target_tag_prim_sp_target_tag - ON sp_target_tag - USING BTREE (tenant, id); +ON sp_target_tag +USING BTREE (tenant, id); CREATE INDEX sp_idx_tenant_prim_sp_tenant - ON sp_tenant - USING BTREE (tenant, id); +ON sp_tenant +USING BTREE (tenant, id); -- ------------ Write CREATE-CONSTRAINT-stage scripts ----------- ALTER TABLE sp_action - ADD CONSTRAINT pk_sp_action PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_action PRIMARY KEY (id); ALTER TABLE sp_action_status - ADD CONSTRAINT pk_sp_action_status PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_action_status PRIMARY KEY (id); ALTER TABLE sp_artifact - ADD CONSTRAINT pk_sp_artifact PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_artifact PRIMARY KEY (id); ALTER TABLE sp_base_software_module - ADD CONSTRAINT pk_sp_base_software_module PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_base_software_module PRIMARY KEY (id); ALTER TABLE sp_base_software_module - ADD CONSTRAINT uk_base_sw_mod_sp_base_software_module UNIQUE (module_type, name, version, tenant); +ADD CONSTRAINT uk_base_sw_mod_sp_base_software_module UNIQUE (module_type, name, version, tenant); ALTER TABLE sp_distribution_set - ADD CONSTRAINT pk_sp_distribution_set PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_distribution_set PRIMARY KEY (id); ALTER TABLE sp_distribution_set - ADD CONSTRAINT uk_distrib_set_sp_distribution_set UNIQUE (name, version, tenant); +ADD CONSTRAINT uk_distrib_set_sp_distribution_set UNIQUE (name, version, tenant); ALTER TABLE sp_distribution_set_type - ADD CONSTRAINT pk_sp_distribution_set_type PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_distribution_set_type PRIMARY KEY (id); ALTER TABLE sp_distribution_set_type - ADD CONSTRAINT uk_dst_key_sp_distribution_set_type UNIQUE (type_key, tenant); +ADD CONSTRAINT uk_dst_key_sp_distribution_set_type UNIQUE (type_key, tenant); ALTER TABLE sp_distribution_set_type - ADD CONSTRAINT uk_dst_name_sp_distribution_set_type UNIQUE (name, tenant); +ADD CONSTRAINT uk_dst_name_sp_distribution_set_type UNIQUE (name, tenant); ALTER TABLE sp_distributionset_tag - ADD CONSTRAINT pk_sp_distributionset_tag PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_distributionset_tag PRIMARY KEY (id); ALTER TABLE sp_distributionset_tag - ADD CONSTRAINT uk_ds_tag_sp_distributionset_tag UNIQUE (name, tenant); +ADD CONSTRAINT uk_ds_tag_sp_distributionset_tag UNIQUE (name, tenant); ALTER TABLE sp_ds_dstag - ADD CONSTRAINT pk_sp_ds_dstag PRIMARY KEY (ds, tag); +ADD CONSTRAINT pk_sp_ds_dstag PRIMARY KEY (ds, tag); ALTER TABLE sp_ds_metadata - ADD CONSTRAINT pk_sp_ds_metadata PRIMARY KEY (ds_id, meta_key); +ADD CONSTRAINT pk_sp_ds_metadata PRIMARY KEY (ds_id, meta_key); ALTER TABLE sp_ds_module - ADD CONSTRAINT pk_sp_ds_module PRIMARY KEY (ds_id, module_id); +ADD CONSTRAINT pk_sp_ds_module PRIMARY KEY (ds_id, module_id); ALTER TABLE sp_ds_type_element - ADD CONSTRAINT pk_sp_ds_type_element PRIMARY KEY (distribution_set_type, software_module_type); +ADD CONSTRAINT pk_sp_ds_type_element PRIMARY KEY (distribution_set_type, software_module_type); ALTER TABLE sp_rollout - ADD CONSTRAINT pk_sp_rollout PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_rollout PRIMARY KEY (id); ALTER TABLE sp_rollout - ADD CONSTRAINT uk_rollout_sp_rollout UNIQUE (name, tenant); +ADD CONSTRAINT uk_rollout_sp_rollout UNIQUE (name, tenant); ALTER TABLE sp_rolloutgroup - ADD CONSTRAINT pk_sp_rolloutgroup PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_rolloutgroup PRIMARY KEY (id); ALTER TABLE sp_rolloutgroup - ADD CONSTRAINT uk_rolloutgroup_sp_rolloutgroup UNIQUE (name, rollout, tenant); +ADD CONSTRAINT uk_rolloutgroup_sp_rolloutgroup UNIQUE (name, rollout, tenant); ALTER TABLE sp_rollouttargetgroup - ADD CONSTRAINT pk_sp_rollouttargetgroup PRIMARY KEY (rolloutgroup_id, target_id); +ADD CONSTRAINT pk_sp_rollouttargetgroup PRIMARY KEY (rolloutgroup_id, target_id); ALTER TABLE sp_software_module_type - ADD CONSTRAINT pk_sp_software_module_type PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_software_module_type PRIMARY KEY (id); ALTER TABLE sp_software_module_type - ADD CONSTRAINT uk_smt_name_sp_software_module_type UNIQUE (name, tenant); +ADD CONSTRAINT uk_smt_name_sp_software_module_type UNIQUE (name, tenant); ALTER TABLE sp_software_module_type - ADD CONSTRAINT uk_smt_type_key_sp_software_module_type UNIQUE (type_key, tenant); +ADD CONSTRAINT uk_smt_type_key_sp_software_module_type UNIQUE (type_key, tenant); ALTER TABLE sp_sw_metadata - ADD CONSTRAINT pk_sp_sw_metadata PRIMARY KEY (meta_key, sw_id); +ADD CONSTRAINT pk_sp_sw_metadata PRIMARY KEY (meta_key, sw_id); ALTER TABLE sp_target - ADD CONSTRAINT pk_sp_target PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_target PRIMARY KEY (id); ALTER TABLE sp_target - ADD CONSTRAINT uk_tenant_controller_id_sp_target UNIQUE (controller_id, tenant); +ADD CONSTRAINT uk_tenant_controller_id_sp_target UNIQUE (controller_id, tenant); ALTER TABLE sp_target_attributes - ADD CONSTRAINT pk_sp_target_attributes PRIMARY KEY (target_id, attribute_key); +ADD CONSTRAINT pk_sp_target_attributes PRIMARY KEY (target_id, attribute_key); ALTER TABLE sp_target_filter_query - ADD CONSTRAINT pk_sp_target_filter_query PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_target_filter_query PRIMARY KEY (id); ALTER TABLE sp_target_filter_query - ADD CONSTRAINT uk_tenant_custom_filter_name_sp_target_filter_query UNIQUE (name, tenant); +ADD CONSTRAINT uk_tenant_custom_filter_name_sp_target_filter_query UNIQUE (name, tenant); ALTER TABLE sp_target_metadata - ADD CONSTRAINT pk_sp_target_metadata PRIMARY KEY (target_id, meta_key); +ADD CONSTRAINT pk_sp_target_metadata PRIMARY KEY (target_id, meta_key); ALTER TABLE sp_target_tag - ADD CONSTRAINT pk_sp_target_tag PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_target_tag PRIMARY KEY (id); ALTER TABLE sp_target_tag - ADD CONSTRAINT uk_targ_tag_sp_target_tag UNIQUE (name, tenant); +ADD CONSTRAINT uk_targ_tag_sp_target_tag UNIQUE (name, tenant); ALTER TABLE sp_target_target_tag - ADD CONSTRAINT pk_sp_target_target_tag PRIMARY KEY (target, tag); +ADD CONSTRAINT pk_sp_target_target_tag PRIMARY KEY (target, tag); ALTER TABLE sp_tenant - ADD CONSTRAINT pk_sp_tenant PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_tenant PRIMARY KEY (id); ALTER TABLE sp_tenant - ADD CONSTRAINT uk_tenantmd_tenant_sp_tenant UNIQUE (tenant); +ADD CONSTRAINT uk_tenantmd_tenant_sp_tenant UNIQUE (tenant); ALTER TABLE sp_tenant_configuration - ADD CONSTRAINT pk_sp_tenant_configuration PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_tenant_configuration PRIMARY KEY (id); ALTER TABLE sp_tenant_configuration - ADD CONSTRAINT uk_tenant_key_sp_tenant_configuration UNIQUE (conf_key, tenant); +ADD CONSTRAINT uk_tenant_key_sp_tenant_configuration UNIQUE (conf_key, tenant); -- ------------ Write CREATE-FOREIGN-KEY-CONSTRAINT-stage scripts ----------- ALTER TABLE sp_action - ADD CONSTRAINT fk_action_ds FOREIGN KEY (distribution_set) - REFERENCES sp_distribution_set (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_action_ds FOREIGN KEY (distribution_set) +REFERENCES sp_distribution_set (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; ALTER TABLE sp_action - ADD CONSTRAINT fk_action_rollout FOREIGN KEY (rollout) - REFERENCES sp_rollout (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_action_rollout FOREIGN KEY (rollout) +REFERENCES sp_rollout (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; ALTER TABLE sp_action - ADD CONSTRAINT fk_action_rolloutgroup FOREIGN KEY (rolloutgroup) - REFERENCES sp_rolloutgroup (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_action_rolloutgroup FOREIGN KEY (rolloutgroup) +REFERENCES sp_rolloutgroup (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; ALTER TABLE sp_action - ADD CONSTRAINT fk_targ_act_hist_targ FOREIGN KEY (target) - REFERENCES sp_target (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_targ_act_hist_targ FOREIGN KEY (target) +REFERENCES sp_target (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_action_status - ADD CONSTRAINT fk_act_stat_action FOREIGN KEY (action) - REFERENCES sp_action (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_act_stat_action FOREIGN KEY (action) +REFERENCES sp_action (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_action_status_messages - ADD CONSTRAINT fk_stat_msg_act_stat FOREIGN KEY (action_status_id) - REFERENCES sp_action_status (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_stat_msg_act_stat FOREIGN KEY (action_status_id) +REFERENCES sp_action_status (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_artifact - ADD CONSTRAINT fk_assigned_sm FOREIGN KEY (software_module) - REFERENCES sp_base_software_module (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_assigned_sm FOREIGN KEY (software_module) +REFERENCES sp_base_software_module (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_base_software_module - ADD CONSTRAINT fk_module_type FOREIGN KEY (module_type) - REFERENCES sp_software_module_type (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_module_type FOREIGN KEY (module_type) +REFERENCES sp_software_module_type (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; ALTER TABLE sp_distribution_set - ADD CONSTRAINT fk_ds_dstype_ds FOREIGN KEY (ds_id) - REFERENCES sp_distribution_set_type (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_ds_dstype_ds FOREIGN KEY (ds_id) +REFERENCES sp_distribution_set_type (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; ALTER TABLE sp_ds_dstag - ADD CONSTRAINT fk_ds_dstag_ds FOREIGN KEY (ds) - REFERENCES sp_distribution_set (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_ds_dstag_ds FOREIGN KEY (ds) +REFERENCES sp_distribution_set (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_ds_dstag - ADD CONSTRAINT fk_ds_dstag_tag FOREIGN KEY (tag) - REFERENCES sp_distributionset_tag (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_ds_dstag_tag FOREIGN KEY (tag) +REFERENCES sp_distributionset_tag (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_ds_metadata - ADD CONSTRAINT fk_metadata_ds FOREIGN KEY (ds_id) - REFERENCES sp_distribution_set (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_metadata_ds FOREIGN KEY (ds_id) +REFERENCES sp_distribution_set (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_ds_module - ADD CONSTRAINT fk_ds_module_ds FOREIGN KEY (ds_id) - REFERENCES sp_distribution_set (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_ds_module_ds FOREIGN KEY (ds_id) +REFERENCES sp_distribution_set (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_ds_module - ADD CONSTRAINT fk_ds_module_module FOREIGN KEY (module_id) - REFERENCES sp_base_software_module (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_ds_module_module FOREIGN KEY (module_id) +REFERENCES sp_base_software_module (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_element FOREIGN KEY (distribution_set_type) - REFERENCES sp_distribution_set_type (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_ds_type_element_element FOREIGN KEY (distribution_set_type) +REFERENCES sp_distribution_set_type (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_smtype FOREIGN KEY (software_module_type) - REFERENCES sp_software_module_type (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_ds_type_element_smtype FOREIGN KEY (software_module_type) +REFERENCES sp_software_module_type (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_rollout - ADD CONSTRAINT fk_rollout_ds FOREIGN KEY (distribution_set) - REFERENCES sp_distribution_set (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_rollout_ds FOREIGN KEY (distribution_set) +REFERENCES sp_distribution_set (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; ALTER TABLE sp_rolloutgroup - ADD CONSTRAINT fk_rolloutgroup_rollout FOREIGN KEY (rollout) - REFERENCES sp_rollout (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_rolloutgroup_rollout FOREIGN KEY (rollout) +REFERENCES sp_rollout (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_rollouttargetgroup - ADD CONSTRAINT fk_rollouttargetgroup_rolloutgroup FOREIGN KEY (rolloutgroup_id) - REFERENCES sp_rolloutgroup (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_rollouttargetgroup_rolloutgroup FOREIGN KEY (rolloutgroup_id) +REFERENCES sp_rolloutgroup (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_rollouttargetgroup - ADD CONSTRAINT fk_rollouttargetgroup_target FOREIGN KEY (target_id) - REFERENCES sp_target (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_rollouttargetgroup_target FOREIGN KEY (target_id) +REFERENCES sp_target (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_sw_metadata - ADD CONSTRAINT fk_metadata_sw FOREIGN KEY (sw_id) - REFERENCES sp_base_software_module (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_metadata_sw FOREIGN KEY (sw_id) +REFERENCES sp_base_software_module (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_target - ADD CONSTRAINT fk_target_assign_ds FOREIGN KEY (assigned_distribution_set) - REFERENCES sp_distribution_set (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_target_assign_ds FOREIGN KEY (assigned_distribution_set) +REFERENCES sp_distribution_set (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; ALTER TABLE sp_target - ADD CONSTRAINT fk_target_inst_ds FOREIGN KEY (installed_distribution_set) - REFERENCES sp_distribution_set (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_target_inst_ds FOREIGN KEY (installed_distribution_set) +REFERENCES sp_distribution_set (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; ALTER TABLE sp_target_attributes - ADD CONSTRAINT fk_targ_attrib_target FOREIGN KEY (target_id) - REFERENCES sp_target (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_targ_attrib_target FOREIGN KEY (target_id) +REFERENCES sp_target (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_target_filter_query - ADD CONSTRAINT fk_filter_auto_assign_ds FOREIGN KEY (auto_assign_distribution_set) - REFERENCES sp_distribution_set (id) - ON UPDATE RESTRICT - ON DELETE SET NULL; +ADD CONSTRAINT fk_filter_auto_assign_ds FOREIGN KEY (auto_assign_distribution_set) +REFERENCES sp_distribution_set (id) +ON UPDATE RESTRICT +ON DELETE SET NULL; ALTER TABLE sp_target_metadata - ADD CONSTRAINT fk_metadata_target FOREIGN KEY (target_id) - REFERENCES sp_target (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_metadata_target FOREIGN KEY (target_id) +REFERENCES sp_target (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_target_target_tag - ADD CONSTRAINT fk_targ_targtag_tag FOREIGN KEY (tag) - REFERENCES sp_target_tag (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_targ_targtag_tag FOREIGN KEY (tag) +REFERENCES sp_target_tag (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_target_target_tag - ADD CONSTRAINT fk_targ_targtag_target FOREIGN KEY (target) - REFERENCES sp_target (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_targ_targtag_target FOREIGN KEY (target) +REFERENCES sp_target (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_tenant - ADD CONSTRAINT fk_tenant_md_default_ds_type FOREIGN KEY (default_ds_type) - REFERENCES sp_distribution_set_type (id) - ON UPDATE RESTRICT - ON DELETE RESTRICT; +ADD CONSTRAINT fk_tenant_md_default_ds_type FOREIGN KEY (default_ds_type) +REFERENCES sp_distribution_set_type (id) +ON UPDATE RESTRICT +ON DELETE RESTRICT; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_16__add_action_initiated_by___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_16__add_action_initiated_by___POSTGRESQL.sql index 034090ae8..14a68bfd3 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_16__add_action_initiated_by___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_16__add_action_initiated_by___POSTGRESQL.sql @@ -1,7 +1,7 @@ ALTER TABLE sp_action - ADD COLUMN initiated_by VARCHAR(64) NOT NULL DEFAULT ''; +ADD COLUMN initiated_by VARCHAR (64) NOT NULL DEFAULT ''; ALTER TABLE sp_action - ALTER COLUMN initiated_by DROP DEFAULT; +ALTER COLUMN initiated_by DROP DEFAULT; ALTER TABLE sp_target_filter_query - ADD COLUMN auto_assign_initiated_by VARCHAR(64); \ No newline at end of file +ADD COLUMN auto_assign_initiated_by VARCHAR (64); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_17__add_index_target_modified___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_17__add_index_target_modified___POSTGRESQL.sql index 10ea8e46a..e509359e4 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_17__add_index_target_modified___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_17__add_index_target_modified___POSTGRESQL.sql @@ -1,3 +1,3 @@ CREATE INDEX sp_idx_target_05 - ON sp_target - USING BTREE (tenant, last_modified_at); \ No newline at end of file +ON sp_target +USING BTREE (tenant, last_modified_at); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_18__add_target_type___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_18__add_target_type___POSTGRESQL.sql index 857ba4637..8acd8038d 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_18__add_target_type___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_18__add_target_type___POSTGRESQL.sql @@ -7,9 +7,8 @@ NO CYCLE; -- ------------ Write CREATE-TABLE-stage scripts ----------- -CREATE TABLE sp_target_type -( - id BIGINT NOT NULL DEFAULT nextval('sp_target_type_seq'), +CREATE TABLE sp_target_type( + id BIGINT NOT NULL DEFAULT nextval('sp_target_type_seq'), created_at BIGINT, created_by VARCHAR(64), last_modified_at BIGINT, @@ -20,48 +19,47 @@ CREATE TABLE sp_target_type name VARCHAR(64), colour VARCHAR(16) ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -CREATE TABLE sp_target_type_ds_type_relation -( +CREATE TABLE sp_target_type_ds_type_relation( target_type BIGINT NOT NULL, distribution_set_type BIGINT NOT NULL ) - WITH ( - OIDS = FALSE + WITH ( + OIDS=FALSE ); -- ------------ Alter Table and Write INDEX scripts ----------- ALTER TABLE sp_target_type - ADD CONSTRAINT pk_sp_target_type PRIMARY KEY (id); +ADD CONSTRAINT pk_sp_target_type PRIMARY KEY (id); ALTER TABLE sp_target_type - ADD CONSTRAINT uk_target_type_name UNIQUE (name, tenant); +ADD CONSTRAINT uk_target_type_name UNIQUE (name, tenant); CREATE INDEX sp_idx_target_type_prim - ON sp_target_type - USING BTREE (tenant, id); +ON sp_target_type +USING BTREE (tenant, id); ALTER TABLE sp_target - ADD COLUMN target_type BIGINT; +ADD COLUMN target_type BIGINT; ALTER TABLE sp_target - ADD CONSTRAINT fk_target_relation_target_type FOREIGN KEY (target_type) - REFERENCES sp_target_type (id) - ON UPDATE RESTRICT - ON DELETE SET NULL; +ADD CONSTRAINT fk_target_relation_target_type FOREIGN KEY (target_type) +REFERENCES sp_target_type (id) +ON UPDATE RESTRICT +ON DELETE SET NULL; ALTER TABLE sp_target_type_ds_type_relation - ADD CONSTRAINT fk_target_type_relation_target_type FOREIGN KEY (target_type) - REFERENCES sp_target_type (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; +ADD CONSTRAINT fk_target_type_relation_target_type FOREIGN KEY (target_type) +REFERENCES sp_target_type (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; ALTER TABLE sp_target_type_ds_type_relation - ADD CONSTRAINT fk_target_type_relation_ds_type FOREIGN KEY (distribution_set_type) - REFERENCES sp_distribution_set_type (id) - ON UPDATE RESTRICT - ON DELETE CASCADE; \ No newline at end of file +ADD CONSTRAINT fk_target_type_relation_ds_type FOREIGN KEY (distribution_set_type) +REFERENCES sp_distribution_set_type (id) +ON UPDATE RESTRICT +ON DELETE CASCADE; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_19__add_valid_flag_to_ds___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_19__add_valid_flag_to_ds___POSTGRESQL.sql index 9f1194af5..6d2f70e74 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_19__add_valid_flag_to_ds___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_19__add_valid_flag_to_ds___POSTGRESQL.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_distribution_set - ADD COLUMN valid BOOLEAN; +ALTER TABLE sp_distribution_set ADD COLUMN valid BOOLEAN; -UPDATE sp_distribution_set -SET valid = TRUE; \ No newline at end of file +UPDATE sp_distribution_set SET valid = TRUE; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_20__add_encryption_flag_to_sm___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_20__add_encryption_flag_to_sm___POSTGRESQL.sql index 3366980a1..00ae94f2d 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_20__add_encryption_flag_to_sm___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_20__add_encryption_flag_to_sm___POSTGRESQL.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_base_software_module - ADD COLUMN encrypted BOOLEAN; +ALTER TABLE sp_base_software_module ADD COLUMN encrypted BOOLEAN; -UPDATE sp_base_software_module -SET encrypted = FALSE; \ No newline at end of file +UPDATE sp_base_software_module SET encrypted = FALSE; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_21__add_rollouts_status_index___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_21__add_rollouts_status_index___POSTGRESQL.sql index f6c0a1a55..0d4783710 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_21__add_rollouts_status_index___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_21__add_rollouts_status_index___POSTGRESQL.sql @@ -1,3 +1,3 @@ CREATE INDEX sp_idx_rollout_status_tenant - ON sp_rollout - USING BTREE (tenant, status); \ No newline at end of file +ON sp_rollout +USING BTREE (tenant, status); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_23__add_action_status_code___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_23__add_action_status_code___POSTGRESQL.sql index 9ec28c334..623bc3141 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_23__add_action_status_code___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_23__add_action_status_code___POSTGRESQL.sql @@ -1,5 +1,4 @@ -ALTER TABLE sp_action_status - ADD COLUMN code INTEGER; +ALTER TABLE sp_action_status ADD COLUMN code INTEGER; CREATE INDEX sp_idx_action_status_03 ON sp_action_status USING BTREE (tenant, code); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_24__add_last_action_status_code___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_24__add_last_action_status_code___POSTGRESQL.sql index 76ec231cf..d5a4cc232 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_24__add_last_action_status_code___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_24__add_last_action_status_code___POSTGRESQL.sql @@ -1,2 +1 @@ -ALTER TABLE sp_action - ADD last_action_status_code INTEGER; \ No newline at end of file +ALTER TABLE sp_action ADD last_action_status_code INTEGER; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_25__add_confirmation_flag___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_25__add_confirmation_flag___POSTGRESQL.sql index a0aea8e78..265771afe 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_25__add_confirmation_flag___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_25__add_confirmation_flag___POSTGRESQL.sql @@ -3,10 +3,8 @@ ALTER TABLE sp_rolloutgroup ALTER TABLE sp_target_filter_query ADD COLUMN confirmation_required BOOLEAN; -UPDATE sp_rolloutgroup -SET confirmation_required = FALSE; -UPDATE sp_target_filter_query -SET confirmation_required = FALSE; +UPDATE sp_rolloutgroup SET confirmation_required = FALSE; +UPDATE sp_target_filter_query SET confirmation_required = FALSE; CREATE TABLE sp_target_conf_status ( diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_26__add_access_control_context___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_26__add_access_control_context___POSTGRESQL.sql index fb06922c7..ccf16963e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_26__add_access_control_context___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_26__add_access_control_context___POSTGRESQL.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_target_filter_query - ADD COLUMN access_control_context VARCHAR(4096); -ALTER TABLE sp_rollout - ADD COLUMN access_control_context VARCHAR(4096); \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD COLUMN access_control_context VARCHAR(4096); +ALTER TABLE sp_rollout ADD COLUMN access_control_context VARCHAR(4096); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_27__target_type_inherit_type___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_27__target_type_inherit_type___POSTGRESQL.sql index 2b63926eb..86e3350b8 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_27__target_type_inherit_type___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_27__target_type_inherit_type___POSTGRESQL.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_target_type - ADD COLUMN type_key VARCHAR(64) NOT NULL DEFAULT ('_'); -UPDATE sp_target_type -SET type_key = name; -ALTER TABLE sp_target_type - ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file +ALTER TABLE sp_target_type ADD COLUMN type_key VARCHAR (64) NOT NULL DEFAULT ('_'); +UPDATE sp_target_type SET type_key = name; +ALTER TABLE sp_target_type ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_28__add_dynamic_rollout___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_28__add_dynamic_rollout___POSTGRESQL.sql index 001527803..de6a6f14f 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_28__add_dynamic_rollout___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_28__add_dynamic_rollout___POSTGRESQL.sql @@ -1,20 +1,9 @@ -ALTER TABLE sp_rollout - ADD COLUMN is_dynamic BOOLEAN; -ALTER TABLE sp_rolloutgroup - ADD COLUMN is_dynamic BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE sp_rollout ADD COLUMN is_dynamic BOOLEAN; +ALTER TABLE sp_rolloutgroup ADD COLUMN is_dynamic BOOLEAN NOT NULL DEFAULT false; -UPDATE sp_rollout -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_action -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_target_filter_query -SET auto_assign_weight = 1000 -WHERE auto_assign_weight IS NULL; -ALTER TABLE sp_rollout - ALTER COLUMN weight SET NOT NULL; -ALTER TABLE sp_action - ALTER COLUMN weight SET NOT NULL; -ALTER TABLE sp_target_filter_query - ALTER COLUMN auto_assign_weight SET NOT NULL; \ No newline at end of file +UPDATE sp_rollout SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_action SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_target_filter_query SET auto_assign_weight = 1000 WHERE auto_assign_weight IS NULL; +ALTER TABLE sp_rollout ALTER COLUMN weight SET NOT NULL; +ALTER TABLE sp_action ALTER COLUMN weight SET NOT NULL; +ALTER TABLE sp_target_filter_query ALTER COLUMN auto_assign_weight SET NOT NULL; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_29__add_ds_sm_locked___POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_29__add_ds_sm_locked___POSTGRESQL.sql index 831528f40..c5c0de6fb 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_29__add_ds_sm_locked___POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/POSTGRESQL/V1_12_29__add_ds_sm_locked___POSTGRESQL.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_base_software_module - ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; -ALTER TABLE sp_distribution_set - ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; \ No newline at end of file +ALTER TABLE sp_base_software_module ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; +ALTER TABLE sp_distribution_set ADD COLUMN locked BOOLEAN NOT NULL DEFAULT true; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_11__add_auto_assign_action_type___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_11__add_auto_assign_action_type___SQL_SERVER.sql index 8e5680514..0e8c37bda 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_11__add_auto_assign_action_type___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_11__add_auto_assign_action_type___SQL_SERVER.sql @@ -1,2 +1 @@ -ALTER TABLE sp_target_filter_query - ADD auto_assign_action_type INTEGER; \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD auto_assign_action_type INTEGER; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_13__add_action_external_id___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_13__add_action_external_id___SQL_SERVER.sql index aef991e40..b5ca92aec 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_13__add_action_external_id___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_13__add_action_external_id___SQL_SERVER.sql @@ -1,5 +1,4 @@ -ALTER TABLE sp_action - ADD external_ref VARCHAR(512); +ALTER TABLE sp_action ADD external_ref VARCHAR(512); CREATE INDEX sp_idx_action_external_ref ON sp_action (external_ref); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_14__add_sha256_hash___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_14__add_sha256_hash___SQL_SERVER.sql index 364792ae6..c72b8b124 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_14__add_sha256_hash___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_14__add_sha256_hash___SQL_SERVER.sql @@ -1,2 +1 @@ -ALTER TABLE sp_artifact - ADD sha256_hash CHAR(64); \ No newline at end of file +ALTER TABLE sp_artifact ADD sha256_hash CHAR(64); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_15__add_weight___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_15__add_weight___SQL_SERVER.sql index 12db78a80..9eaad20e1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_15__add_weight___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_15__add_weight___SQL_SERVER.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_action - ADD weight INT; -ALTER TABLE sp_rollout - ADD weight INT; -ALTER TABLE sp_target_filter_query - ADD auto_assign_weight INT; +ALTER TABLE sp_action ADD weight INT; +ALTER TABLE sp_rollout ADD weight INT; +ALTER TABLE sp_target_filter_query ADD auto_assign_weight INT; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_16__add_action_initiated_by___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_16__add_action_initiated_by___SQL_SERVER.sql index e9d92bdbd..dc6eae613 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_16__add_action_initiated_by___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_16__add_action_initiated_by___SQL_SERVER.sql @@ -1,5 +1,3 @@ -ALTER TABLE sp_action - ADD initiated_by VARCHAR(64) NOT NULL CONSTRAINT DF_SpAction_InitiatedBy DEFAULT ''; +ALTER TABLE sp_action ADD initiated_by VARCHAR(64) NOT NULL CONSTRAINT DF_SpAction_InitiatedBy DEFAULT ''; ALTER TABLE sp_action DROP CONSTRAINT DF_SpAction_InitiatedBy; -ALTER TABLE sp_target_filter_query - ADD auto_assign_initiated_by VARCHAR(64); +ALTER TABLE sp_target_filter_query ADD auto_assign_initiated_by VARCHAR(64); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_18__add_target_type___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_18__add_target_type___SQL_SERVER.sql index 308f198c8..924e0681c 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_18__add_target_type___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_18__add_target_type___SQL_SERVER.sql @@ -1,32 +1,27 @@ CREATE TABLE sp_target_type ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16) NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(64) NOT NULL, - description VARCHAR(512) NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16) NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(64) NOT NULL, + description VARCHAR(512) NULL, last_modified_at NUMERIC(19) NOT NULL, last_modified_by VARCHAR(64) NOT NULL, - name VARCHAR(64) NOT NULL, + name VARCHAR(64) NOT NULL, optlock_revision INTEGER NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_target_type_prim ON sp_target_type (tenant, id); CREATE TABLE sp_target_type_ds_type_relation ( - target_type NUMERIC(19) NOT NULL, + target_type NUMERIC(19) NOT NULL, distribution_set_type NUMERIC(19) NOT NULL, PRIMARY KEY (target_type, distribution_set_type) ); -ALTER TABLE sp_target_type - ADD CONSTRAINT uk_target_type_name UNIQUE (name, tenant); -ALTER TABLE sp_target - ADD target_type NUMERIC(19) NULL; -ALTER TABLE sp_target - ADD CONSTRAINT fk_target_relation_target_type FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE SET NULL; -ALTER TABLE sp_target_type_ds_type_relation - ADD CONSTRAINT fk_target_type_relation_target_type FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE CASCADE; -ALTER TABLE sp_target_type_ds_type_relation - ADD CONSTRAINT fk_target_type_relation_ds_type FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE; +ALTER TABLE sp_target_type ADD CONSTRAINT uk_target_type_name UNIQUE (name, tenant); +ALTER TABLE sp_target ADD target_type NUMERIC(19) NULL; +ALTER TABLE sp_target ADD CONSTRAINT fk_target_relation_target_type FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE SET NULL; +ALTER TABLE sp_target_type_ds_type_relation ADD CONSTRAINT fk_target_type_relation_target_type FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE CASCADE; +ALTER TABLE sp_target_type_ds_type_relation ADD CONSTRAINT fk_target_type_relation_ds_type FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_19__add_valid_flag_to_ds___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_19__add_valid_flag_to_ds___SQL_SERVER.sql index 33c7369ba..1ec1d0407 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_19__add_valid_flag_to_ds___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_19__add_valid_flag_to_ds___SQL_SERVER.sql @@ -1,2 +1 @@ -ALTER TABLE sp_distribution_set - ADD valid BIT DEFAULT 1; \ No newline at end of file +ALTER TABLE sp_distribution_set ADD valid BIT DEFAULT 1; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_20__add_encryption_flag_to_sm___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_20__add_encryption_flag_to_sm___SQL_SERVER.sql index ad1eec100..092fdbdcc 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_20__add_encryption_flag_to_sm___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_20__add_encryption_flag_to_sm___SQL_SERVER.sql @@ -1,2 +1 @@ -ALTER TABLE sp_base_software_module - ADD encrypted BIT DEFAULT 0; \ No newline at end of file +ALTER TABLE sp_base_software_module ADD encrypted BIT DEFAULT 0; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_23__add_action_status_code___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_23__add_action_status_code___SQL_SERVER.sql index 9b107a092..38a6aeaab 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_23__add_action_status_code___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_23__add_action_status_code___SQL_SERVER.sql @@ -1,3 +1,2 @@ -ALTER TABLE sp_action_status - ADD code INT; +ALTER TABLE sp_action_status ADD code INT; CREATE INDEX sp_idx_action_status_03 ON sp_action_status (tenant, code); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_24__add_last_action_status_code___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_24__add_last_action_status_code___SQL_SERVER.sql index 3fc8e3ea5..db38eeb10 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_24__add_last_action_status_code___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_24__add_last_action_status_code___SQL_SERVER.sql @@ -1,2 +1 @@ -ALTER TABLE sp_action - ADD last_action_status_code INT; \ No newline at end of file +ALTER TABLE sp_action ADD last_action_status_code INT; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_25__add_confirmation_flag___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_25__add_confirmation_flag___SQL_SERVER.sql index 230a3248c..0cd9e2fef 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_25__add_confirmation_flag___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_25__add_confirmation_flag___SQL_SERVER.sql @@ -1,20 +1,18 @@ -ALTER TABLE sp_rolloutgroup - ADD confirmation_required BIT DEFAULT 0; -ALTER TABLE sp_target_filter_query - ADD confirmation_required BIT DEFAULT 0; +ALTER TABLE sp_rolloutgroup ADD confirmation_required BIT DEFAULT 0; +ALTER TABLE sp_target_filter_query ADD confirmation_required BIT DEFAULT 0; CREATE TABLE sp_target_conf_status ( - id NUMERIC(19) IDENTITY NOT NULL, - target_id NUMERIC(19) NOT NULL, - initiator VARCHAR(64), - remark VARCHAR(512), - tenant VARCHAR(40) NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(64) NOT NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(64) NOT NULL, - optlock_revision INTEGER NULL, + id NUMERIC(19) IDENTITY NOT NULL, + target_id NUMERIC(19) NOT NULL, + initiator VARCHAR(64), + remark VARCHAR(512), + tenant VARCHAR(40) NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(64) NOT NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(64) NOT NULL, + optlock_revision INTEGER NULL, PRIMARY KEY (id) ); ALTER TABLE sp_target_conf_status diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_26__add_access_control_context___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_26__add_access_control_context___SQL_SERVER.sql index 637b01170..24f81bc7e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_26__add_access_control_context___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_26__add_access_control_context___SQL_SERVER.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_target_filter_query - ADD access_control_context VARCHAR(4096); -ALTER TABLE sp_rollout - ADD access_control_context VARCHAR(4096); \ No newline at end of file +ALTER TABLE sp_target_filter_query ADD access_control_context VARCHAR(4096); +ALTER TABLE sp_rollout ADD access_control_context VARCHAR(4096); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_27__target_type_inherit_type___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_27__target_type_inherit_type___SQL_SERVER.sql index 441854a15..f64339420 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_27__target_type_inherit_type___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_27__target_type_inherit_type___SQL_SERVER.sql @@ -1,6 +1,3 @@ -ALTER TABLE sp_target_type - ADD type_key VARCHAR(64) NOT NULL DEFAULT ('_'); -UPDATE sp_target_type -SET type_key = name; -ALTER TABLE sp_target_type - ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file +ALTER TABLE sp_target_type ADD type_key VARCHAR (64) NOT NULL DEFAULT ('_'); +UPDATE sp_target_type SET type_key = name; +ALTER TABLE sp_target_type ADD CONSTRAINT uk_target_type_key UNIQUE (type_key, tenant); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_28__add_dynamic_rollout___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_28__add_dynamic_rollout___SQL_SERVER.sql index fde4df351..a22a7f997 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_28__add_dynamic_rollout___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_28__add_dynamic_rollout___SQL_SERVER.sql @@ -1,17 +1,9 @@ -ALTER TABLE sp_rollout - ADD is_dynamic BIT; -ALTER TABLE sp_rolloutgroup - ADD is_dynamic BIT NOT NULL DEFAULT 0; +ALTER TABLE sp_rollout ADD is_dynamic BIT; +ALTER TABLE sp_rolloutgroup ADD is_dynamic BIT NOT NULL DEFAULT 0; -UPDATE sp_rollout -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_action -SET weight = 1000 -WHERE weight IS NULL; -UPDATE sp_target_filter_query -SET auto_assign_weight = 1000 -WHERE auto_assign_weight IS NULL; +UPDATE sp_rollout SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_action SET weight = 1000 WHERE weight IS NULL; +UPDATE sp_target_filter_query SET auto_assign_weight = 1000 WHERE auto_assign_weight IS NULL; ALTER TABLE sp_rollout ALTER COLUMN weight INT NOT NULL; ALTER TABLE sp_action ALTER COLUMN weight INT NOT NULL; ALTER TABLE sp_target_filter_query ALTER COLUMN auto_assign_weight INT NOT NULL; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_29__add_ds_sm_locked___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_29__add_ds_sm_locked___SQL_SERVER.sql index 2c391200a..946d0b8e0 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_29__add_ds_sm_locked___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_29__add_ds_sm_locked___SQL_SERVER.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_base_software_module - ADD locked BIT NOT NULL DEFAULT 1; -ALTER TABLE sp_distribution_set - ADD locked BIT NOT NULL DEFAULT 1; \ No newline at end of file +ALTER TABLE sp_base_software_module ADD locked BIT NOT NULL DEFAULT 1; +ALTER TABLE sp_distribution_set ADD locked BIT NOT NULL DEFAULT 1; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_5__baseline___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_5__baseline___SQL_SERVER.sql index 15c665719..42a3895b4 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_5__baseline___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_5__baseline___SQL_SERVER.sql @@ -1,30 +1,30 @@ CREATE TABLE sp_ds_type_element ( - mandatory BIT default 0 NULL, + mandatory BIT default 0 NULL, distribution_set_type NUMERIC(19) NOT NULL, - software_module_type NUMERIC(19) NOT NULL, + software_module_type NUMERIC(19) NOT NULL, PRIMARY KEY (distribution_set_type, software_module_type) ); CREATE TABLE sp_action ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - action_type INTEGER NOT NULL, - active BIT default 0 NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - forced_time NUMERIC(19) NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - optlock_revision INTEGER NULL, - status INTEGER NOT NULL, - distribution_set NUMERIC(19) NOT NULL, - rollout NUMERIC(19) NULL, - rolloutgroup NUMERIC(19) NULL, - target NUMERIC(19) NOT NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + action_type INTEGER NOT NULL, + active BIT default 0 NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + forced_time NUMERIC(19) NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + optlock_revision INTEGER NULL, + status INTEGER NOT NULL, + distribution_set NUMERIC(19) NOT NULL, + rollout NUMERIC(19) NULL, + rolloutgroup NUMERIC(19) NULL, + target NUMERIC(19) NOT NULL, maintenance_cron_schedule VARCHAR(40), - maintenance_duration VARCHAR(40), - maintenance_time_zone VARCHAR(40), + maintenance_duration VARCHAR(40), + maintenance_time_zone VARCHAR(40), PRIMARY KEY (id) ); CREATE INDEX sp_idx_action_01 ON sp_action (tenant, distribution_set); @@ -32,34 +32,34 @@ CREATE INDEX sp_idx_action_02 ON sp_action (tenant, target, active); CREATE INDEX sp_idx_action_prim ON sp_action (tenant, id); CREATE TABLE sp_action_status ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, target_occurred_at NUMERIC(19) NOT NULL, - optlock_revision INTEGER NULL, - status INTEGER NOT NULL, - action NUMERIC(19) NOT NULL, + optlock_revision INTEGER NULL, + status INTEGER NOT NULL, + action NUMERIC(19) NOT NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_action_status_02 ON sp_action_status (tenant, action, status); CREATE INDEX sp_idx_action_status_prim ON sp_action_status (tenant, id); CREATE TABLE sp_artifact ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, provided_file_name VARCHAR(256) NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - md5_hash VARCHAR(32) NULL, - optlock_revision INTEGER NULL, - sha1_hash VARCHAR(40) NOT NULL, - file_size NUMERIC(19) NULL, - software_module NUMERIC(19) NOT NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + md5_hash VARCHAR(32) NULL, + optlock_revision INTEGER NULL, + sha1_hash VARCHAR(40) NOT NULL, + file_size NUMERIC(19) NULL, + software_module NUMERIC(19) NOT NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_artifact_01 ON sp_artifact (tenant, software_module); @@ -67,59 +67,59 @@ CREATE INDEX sp_idx_artifact_02 ON sp_artifact (tenant, sha1_hash); CREATE INDEX sp_idx_artifact_prim ON sp_artifact (tenant, id); CREATE TABLE sp_distribution_set ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - complete BIT default 0 NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted BIT default 0 NULL, - description VARCHAR(512) NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + complete BIT default 0 NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted BIT default 0 NULL, + description VARCHAR(512) NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER NULL, required_migration_step BIT default 0 NULL, - version VARCHAR(64) NOT NULL, - ds_id NUMERIC(19) NOT NULL, + version VARCHAR(64) NOT NULL, + ds_id NUMERIC(19) NOT NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set (tenant, deleted, complete); CREATE INDEX sp_idx_distribution_set_prim ON sp_distribution_set (tenant, id); CREATE TABLE sp_ds_metadata ( - meta_key VARCHAR(128) NOT NULL, + meta_key VARCHAR(128) NOT NULL, meta_value VARCHAR(4000) NULL, - ds_id NUMERIC(19) NOT NULL, + ds_id NUMERIC(19) NOT NULL, PRIMARY KEY (meta_key, ds_id) ); CREATE TABLE sp_distributionset_tag ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16) NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - description VARCHAR(512) NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16) NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + description VARCHAR(512) NULL, last_modified_at NUMERIC(19) NOT NULL, last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, + name VARCHAR(64) NOT NULL, optlock_revision INTEGER NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_distribution_set_tag_prim ON sp_distributionset_tag (tenant, id); CREATE TABLE sp_distribution_set_type ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16) NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted BIT default 0 NULL, - description VARCHAR(512) NULL, - type_key VARCHAR(64) NOT NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16) NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted BIT default 0 NULL, + description VARCHAR(512) NULL, + type_key VARCHAR(64) NOT NULL, last_modified_at NUMERIC(19) NOT NULL, last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, + name VARCHAR(64) NOT NULL, optlock_revision INTEGER NULL, PRIMARY KEY (id) ); @@ -127,69 +127,69 @@ CREATE INDEX sp_idx_distribution_set_type_01 ON sp_distribution_set_type (tenant CREATE INDEX sp_idx_distribution_set_type_prim ON sp_distribution_set_type (tenant, id); CREATE TABLE sp_rollout ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - action_type INTEGER NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted BIT default 0 NULL, - description VARCHAR(512) NULL, - forced_time NUMERIC(19) NULL, - last_check NUMERIC(19) NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + action_type INTEGER NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted BIT default 0 NULL, + description VARCHAR(512) NULL, + forced_time NUMERIC(19) NULL, + last_check NUMERIC(19) NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER NULL, rollout_groups_created INTEGER NULL, - start_at NUMERIC(19) NULL, - status INTEGER NOT NULL, - target_filter VARCHAR(1024) NOT NULL, - total_targets NUMERIC(19) NULL, - distribution_set NUMERIC(19) NOT NULL, + start_at NUMERIC(19) NULL, + status INTEGER NOT NULL, + target_filter VARCHAR(1024) NOT NULL, + total_targets NUMERIC(19) NULL, + distribution_set NUMERIC(19) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE sp_rolloutgroup ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - description VARCHAR(512) NULL, - error_action INTEGER NULL, - error_action_exp VARCHAR(512) NULL, - error_condition INTEGER NULL, - error_condition_exp VARCHAR(512) NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER NULL, - status INTEGER NOT NULL, - success_action INTEGER NOT NULL, - success_action_exp VARCHAR(512) NULL, - success_condition INTEGER NOT NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + description VARCHAR(512) NULL, + error_action INTEGER NULL, + error_action_exp VARCHAR(512) NULL, + error_condition INTEGER NULL, + error_condition_exp VARCHAR(512) NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER NULL, + status INTEGER NOT NULL, + success_action INTEGER NOT NULL, + success_action_exp VARCHAR(512) NULL, + success_condition INTEGER NOT NULL, success_condition_exp VARCHAR(512) NOT NULL, - target_filter VARCHAR(1024) NULL, - target_percentage FLOAT(16) NULL, - total_targets INTEGER NULL, - parent_id NUMERIC(19) NULL, - rollout NUMERIC(19) NOT NULL, + target_filter VARCHAR(1024) NULL, + target_percentage FLOAT(16) NULL, + total_targets INTEGER NULL, + parent_id NUMERIC(19) NULL, + rollout NUMERIC(19) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE sp_base_software_module ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted BIT default 0 NULL, - description VARCHAR(512) NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted BIT default 0 NULL, + description VARCHAR(512) NULL, last_modified_at NUMERIC(19) NOT NULL, last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, + name VARCHAR(64) NOT NULL, optlock_revision INTEGER NULL, - vendor VARCHAR(256) NULL, - version VARCHAR(64) NOT NULL, - module_type NUMERIC(19) NOT NULL, + vendor VARCHAR(256) NULL, + version VARCHAR(64) NOT NULL, + module_type NUMERIC(19) NOT NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_base_sw_module_01 ON sp_base_software_module (tenant, deleted, name, version); @@ -197,51 +197,51 @@ CREATE INDEX sp_idx_base_sw_module_02 ON sp_base_software_module (tenant, delete CREATE INDEX sp_idx_base_sw_module_prim ON sp_base_software_module (tenant, id); CREATE TABLE sp_sw_metadata ( - meta_key VARCHAR(128) NOT NULL, + meta_key VARCHAR(128) NOT NULL, target_visible BIT default 0 NULL, - meta_value VARCHAR(4000) NULL, - sw_id NUMERIC(19) NOT NULL, + meta_value VARCHAR(4000) NULL, + sw_id NUMERIC(19) NOT NULL, PRIMARY KEY (meta_key, sw_id) ); CREATE TABLE sp_software_module_type ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16) NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - deleted BIT default 0 NULL, - description VARCHAR(512) NULL, - type_key VARCHAR(64) NOT NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - max_ds_assignments INTEGER NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16) NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + deleted BIT default 0 NULL, + description VARCHAR(512) NULL, + type_key VARCHAR(64) NOT NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + max_ds_assignments INTEGER NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_software_module_type_01 ON sp_software_module_type (tenant, deleted); CREATE INDEX sp_idx_software_module_type_prim ON sp_software_module_type (tenant, id); CREATE TABLE sp_target ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - address VARCHAR(512) NULL, - controller_id VARCHAR(64) NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - description VARCHAR(512) NULL, - install_date NUMERIC(19) NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - last_target_query NUMERIC(19) NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + address VARCHAR(512) NULL, + controller_id VARCHAR(64) NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + description VARCHAR(512) NULL, + install_date NUMERIC(19) NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + last_target_query NUMERIC(19) NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER NULL, request_controller_attributes BIT default 0 NOT NULL, - sec_token VARCHAR(128) NOT NULL, - update_status INTEGER NOT NULL, - assigned_distribution_set NUMERIC(19) NULL, - installed_distribution_set NUMERIC(19) NULL, + sec_token VARCHAR(128) NOT NULL, + update_status INTEGER NOT NULL, + assigned_distribution_set NUMERIC(19) NULL, + installed_distribution_set NUMERIC(19) NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_target_01 ON sp_target (tenant, name, assigned_distribution_set); @@ -250,176 +250,134 @@ CREATE INDEX sp_idx_target_04 ON sp_target (tenant, created_at); CREATE INDEX sp_idx_target_prim ON sp_target (tenant, id); CREATE TABLE sp_target_filter_query ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, - optlock_revision INTEGER NULL, - query VARCHAR(1024) NOT NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, + name VARCHAR(64) NOT NULL, + optlock_revision INTEGER NULL, + query VARCHAR(1024) NOT NULL, auto_assign_distribution_set NUMERIC(19) NULL, PRIMARY KEY (id) ); CREATE TABLE sp_target_tag ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - colour VARCHAR(16) NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - description VARCHAR(512) NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + colour VARCHAR(16) NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + description VARCHAR(512) NULL, last_modified_at NUMERIC(19) NOT NULL, last_modified_by VARCHAR(40) NOT NULL, - name VARCHAR(64) NOT NULL, + name VARCHAR(64) NOT NULL, optlock_revision INTEGER NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_target_tag_prim ON sp_target_tag (tenant, id); CREATE TABLE sp_tenant_configuration ( - id NUMERIC(19) IDENTITY NOT NULL, - tenant VARCHAR(40) NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, - conf_key VARCHAR(128) NOT NULL, - last_modified_at NUMERIC(19) NOT NULL, - last_modified_by VARCHAR(40) NOT NULL, + id NUMERIC(19) IDENTITY NOT NULL, + tenant VARCHAR(40) NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, + conf_key VARCHAR(128) NOT NULL, + last_modified_at NUMERIC(19) NOT NULL, + last_modified_by VARCHAR(40) NOT NULL, optlock_revision INTEGER NULL, - conf_value VARCHAR(512) NOT NULL, + conf_value VARCHAR(512) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE sp_tenant ( - id NUMERIC(19) IDENTITY NOT NULL, - created_at NUMERIC(19) NOT NULL, - created_by VARCHAR(40) NOT NULL, + id NUMERIC(19) IDENTITY NOT NULL, + created_at NUMERIC(19) NOT NULL, + created_by VARCHAR(40) NOT NULL, last_modified_at NUMERIC(19) NOT NULL, last_modified_by VARCHAR(40) NOT NULL, optlock_revision INTEGER NULL, - tenant VARCHAR(40) NOT NULL, - default_ds_type NUMERIC(19) NOT NULL, + tenant VARCHAR(40) NOT NULL, + default_ds_type NUMERIC(19) NOT NULL, PRIMARY KEY (id) ); CREATE INDEX sp_idx_tenant_prim ON sp_tenant (tenant, id); CREATE TABLE sp_rollouttargetgroup ( rolloutGroup_Id NUMERIC(19) NOT NULL, - target_id NUMERIC(19) NOT NULL, + target_id NUMERIC(19) NOT NULL, PRIMARY KEY (rolloutGroup_Id, target_id) ); CREATE TABLE sp_action_status_messages ( - action_status_id NUMERIC(19) NOT NULL, - detail_message VARCHAR(512) NOT NULL + action_status_id NUMERIC(19) NOT NULL, + detail_message VARCHAR(512) NOT NULL ); CREATE INDEX sp_idx_action_status_msgs_01 ON sp_action_status_messages (action_status_id); CREATE TABLE sp_ds_module ( - ds_id NUMERIC(19) NOT NULL, + ds_id NUMERIC(19) NOT NULL, module_id NUMERIC(19) NOT NULL, PRIMARY KEY (ds_id, module_id) ); CREATE TABLE sp_ds_dstag ( - ds NUMERIC(19) NOT NULL, + ds NUMERIC(19) NOT NULL, TAG NUMERIC(19) NOT NULL, PRIMARY KEY (ds, TAG) ); CREATE TABLE sp_target_attributes ( - target_id NUMERIC(19) NOT NULL, + target_id NUMERIC(19) NOT NULL, attribute_value VARCHAR(128) NULL, - attribute_key VARCHAR(32) NOT NULL + attribute_key VARCHAR(32) NOT NULL ); CREATE TABLE sp_target_target_tag ( target NUMERIC(19) NOT NULL, - tag NUMERIC(19) NOT NULL, + tag NUMERIC(19) NOT NULL, PRIMARY KEY (target, tag) ); -ALTER TABLE sp_distribution_set - ADD CONSTRAINT uk_distrib_set UNIQUE (name, version, tenant); -ALTER TABLE sp_distributionset_tag - ADD CONSTRAINT uk_ds_tag UNIQUE (name, tenant); -ALTER TABLE sp_distribution_set_type - ADD CONSTRAINT uk_dst_name UNIQUE (name, tenant); -ALTER TABLE sp_distribution_set_type - ADD CONSTRAINT uk_dst_key UNIQUE (type_key, tenant); -ALTER TABLE sp_rollout - ADD CONSTRAINT uk_rollout UNIQUE (name, tenant); -ALTER TABLE sp_rolloutgroup - ADD CONSTRAINT uk_rolloutgroup UNIQUE (name, rollout, tenant); -ALTER TABLE sp_base_software_module - ADD CONSTRAINT uk_base_sw_mod UNIQUE (module_type, name, version, tenant); -ALTER TABLE sp_software_module_type - ADD CONSTRAINT uk_smt_type_key UNIQUE (type_key, tenant); -ALTER TABLE sp_software_module_type - ADD CONSTRAINT uk_smt_name UNIQUE (name, tenant); -ALTER TABLE sp_target - ADD CONSTRAINT uk_tenant_controller_ UNIQUE (controller_id, tenant); -ALTER TABLE sp_target_filter_query - ADD CONSTRAINT uk_tenant_custom_filt UNIQUE (name, tenant); -ALTER TABLE sp_target_tag - ADD CONSTRAINT uk_targ_tag UNIQUE (name, tenant); -ALTER TABLE sp_tenant_configuration - ADD CONSTRAINT uk_tenant_key UNIQUE (conf_key, tenant); -ALTER TABLE sp_tenant - ADD CONSTRAINT uk_tenantmd_tenant UNIQUE (tenant); -ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_element FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_type_element - ADD CONSTRAINT fk_ds_type_element_smtype FOREIGN KEY (software_module_type) REFERENCES sp_software_module_type (id) ON DELETE CASCADE; -ALTER TABLE sp_action - ADD CONSTRAINT fk_action_rolloutgroup FOREIGN KEY (rolloutgroup) REFERENCES sp_rolloutgroup (id); -ALTER TABLE sp_action - ADD CONSTRAINT fk_action_rollout FOREIGN KEY (rolloutgroup) REFERENCES sp_rolloutgroup (id); -ALTER TABLE sp_action - ADD CONSTRAINT fk_targ_act_hist_targ FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; -ALTER TABLE sp_action - ADD CONSTRAINT fk_action_ds FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; -ALTER TABLE sp_action_status - ADD CONSTRAINT fk_act_stat_action FOREIGN KEY (action) REFERENCES sp_action (id) ON DELETE CASCADE; -ALTER TABLE sp_artifact - ADD CONSTRAINT fk_assigned_sm FOREIGN KEY (software_module) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; -ALTER TABLE sp_distribution_set - ADD CONSTRAINT fk_ds_dstype_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set_type (id); -ALTER TABLE sp_ds_metadata - ADD CONSTRAINT fk_metadata_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; -ALTER TABLE sp_rollout - ADD CONSTRAINT fk_rollout_ds FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id); -ALTER TABLE sp_rolloutgroup - ADD CONSTRAINT fk_rolloutgroup_rollout FOREIGN KEY (rollout) REFERENCES sp_rollout (id) ON DELETE CASCADE; -ALTER TABLE sp_base_software_module - ADD CONSTRAINT fk_module_type FOREIGN KEY (module_type) REFERENCES sp_software_module_type (id); -ALTER TABLE sp_sw_metadata - ADD CONSTRAINT fk_metadata_sw FOREIGN KEY (sw_id) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; -ALTER TABLE sp_target - ADD CONSTRAINT fk_target_inst_ds FOREIGN KEY (installed_distribution_set) REFERENCES sp_distribution_set (id); -ALTER TABLE sp_target - ADD CONSTRAINT fk_target_assign_ds FOREIGN KEY (assigned_distribution_set) REFERENCES sp_distribution_set (id); -ALTER TABLE sp_target_filter_query - ADD CONSTRAINT fk_filter_auto_assign_ds FOREIGN KEY (auto_assign_distribution_set) REFERENCES sp_distribution_set (id) ON DELETE SET NULL; -ALTER TABLE sp_tenant - ADD CONSTRAINT fk_tenant_md_default_ds_type FOREIGN KEY (default_ds_type) REFERENCES sp_distribution_set_type (id); -ALTER TABLE sp_rollouttargetgroup - ADD CONSTRAINT fk_rollouttargetgroup_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; -ALTER TABLE sp_rollouttargetgroup - ADD CONSTRAINT fk_rollouttargetgroup_group FOREIGN KEY (rolloutGroup_Id) REFERENCES sp_rolloutgroup (id) ON DELETE CASCADE; -ALTER TABLE sp_action_status_messages - ADD CONSTRAINT fk_stat_msg_act_stat FOREIGN KEY (action_status_id) REFERENCES sp_action_status (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_module - ADD CONSTRAINT fk_ds_module_module FOREIGN KEY (module_id) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_module - ADD CONSTRAINT fk_ds_module_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_dstag - ADD CONSTRAINT fk_ds_dstag_tag FOREIGN KEY (tag) REFERENCES sp_distributionset_tag (id) ON DELETE CASCADE; -ALTER TABLE sp_ds_dstag - ADD CONSTRAINT fk_ds_dstag_ds FOREIGN KEY (ds) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; -ALTER TABLE sp_target_attributes - ADD CONSTRAINT fk_targ_attrib_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; -ALTER TABLE sp_target_target_tag - ADD CONSTRAINT fk_targ_targtag_tag FOREIGN KEY (tag) REFERENCES sp_target_tag (id) ON DELETE CASCADE; -ALTER TABLE sp_target_target_tag - ADD CONSTRAINT fk_targ_targtag_target FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_distribution_set ADD CONSTRAINT uk_distrib_set UNIQUE (name, version, tenant); +ALTER TABLE sp_distributionset_tag ADD CONSTRAINT uk_ds_tag UNIQUE (name, tenant); +ALTER TABLE sp_distribution_set_type ADD CONSTRAINT uk_dst_name UNIQUE (name, tenant); +ALTER TABLE sp_distribution_set_type ADD CONSTRAINT uk_dst_key UNIQUE (type_key, tenant); +ALTER TABLE sp_rollout ADD CONSTRAINT uk_rollout UNIQUE (name, tenant); +ALTER TABLE sp_rolloutgroup ADD CONSTRAINT uk_rolloutgroup UNIQUE (name, rollout, tenant); +ALTER TABLE sp_base_software_module ADD CONSTRAINT uk_base_sw_mod UNIQUE (module_type, name, version, tenant); +ALTER TABLE sp_software_module_type ADD CONSTRAINT uk_smt_type_key UNIQUE (type_key, tenant); +ALTER TABLE sp_software_module_type ADD CONSTRAINT uk_smt_name UNIQUE (name, tenant); +ALTER TABLE sp_target ADD CONSTRAINT uk_tenant_controller_ UNIQUE (controller_id, tenant); +ALTER TABLE sp_target_filter_query ADD CONSTRAINT uk_tenant_custom_filt UNIQUE (name, tenant); +ALTER TABLE sp_target_tag ADD CONSTRAINT uk_targ_tag UNIQUE (name, tenant); +ALTER TABLE sp_tenant_configuration ADD CONSTRAINT uk_tenant_key UNIQUE (conf_key, tenant); +ALTER TABLE sp_tenant ADD CONSTRAINT uk_tenantmd_tenant UNIQUE (tenant); +ALTER TABLE sp_ds_type_element ADD CONSTRAINT fk_ds_type_element_element FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_type_element ADD CONSTRAINT fk_ds_type_element_smtype FOREIGN KEY (software_module_type) REFERENCES sp_software_module_type (id) ON DELETE CASCADE; +ALTER TABLE sp_action ADD CONSTRAINT fk_action_rolloutgroup FOREIGN KEY (rolloutgroup) REFERENCES sp_rolloutgroup (id); +ALTER TABLE sp_action ADD CONSTRAINT fk_action_rollout FOREIGN KEY (rolloutgroup) REFERENCES sp_rolloutgroup (id); +ALTER TABLE sp_action ADD CONSTRAINT fk_targ_act_hist_targ FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_action ADD CONSTRAINT fk_action_ds FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; +ALTER TABLE sp_action_status ADD CONSTRAINT fk_act_stat_action FOREIGN KEY (action) REFERENCES sp_action (id) ON DELETE CASCADE; +ALTER TABLE sp_artifact ADD CONSTRAINT fk_assigned_sm FOREIGN KEY (software_module) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; +ALTER TABLE sp_distribution_set ADD CONSTRAINT fk_ds_dstype_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set_type (id); +ALTER TABLE sp_ds_metadata ADD CONSTRAINT fk_metadata_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; +ALTER TABLE sp_rollout ADD CONSTRAINT fk_rollout_ds FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id); +ALTER TABLE sp_rolloutgroup ADD CONSTRAINT fk_rolloutgroup_rollout FOREIGN KEY (rollout) REFERENCES sp_rollout (id) ON DELETE CASCADE; +ALTER TABLE sp_base_software_module ADD CONSTRAINT fk_module_type FOREIGN KEY (module_type) REFERENCES sp_software_module_type (id); +ALTER TABLE sp_sw_metadata ADD CONSTRAINT fk_metadata_sw FOREIGN KEY (sw_id) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; +ALTER TABLE sp_target ADD CONSTRAINT fk_target_inst_ds FOREIGN KEY (installed_distribution_set) REFERENCES sp_distribution_set (id); +ALTER TABLE sp_target ADD CONSTRAINT fk_target_assign_ds FOREIGN KEY (assigned_distribution_set) REFERENCES sp_distribution_set (id); +ALTER TABLE sp_target_filter_query ADD CONSTRAINT fk_filter_auto_assign_ds FOREIGN KEY (auto_assign_distribution_set) REFERENCES sp_distribution_set (id) ON DELETE SET NULL; +ALTER TABLE sp_tenant ADD CONSTRAINT fk_tenant_md_default_ds_type FOREIGN KEY (default_ds_type) REFERENCES sp_distribution_set_type (id); +ALTER TABLE sp_rollouttargetgroup ADD CONSTRAINT fk_rollouttargetgroup_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_rollouttargetgroup ADD CONSTRAINT fk_rollouttargetgroup_group FOREIGN KEY (rolloutGroup_Id) REFERENCES sp_rolloutgroup (id) ON DELETE CASCADE; +ALTER TABLE sp_action_status_messages ADD CONSTRAINT fk_stat_msg_act_stat FOREIGN KEY (action_status_id) REFERENCES sp_action_status (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_module ADD CONSTRAINT fk_ds_module_module FOREIGN KEY (module_id) REFERENCES sp_base_software_module (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_module ADD CONSTRAINT fk_ds_module_ds FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_dstag ADD CONSTRAINT fk_ds_dstag_tag FOREIGN KEY (tag) REFERENCES sp_distributionset_tag (id) ON DELETE CASCADE; +ALTER TABLE sp_ds_dstag ADD CONSTRAINT fk_ds_dstag_ds FOREIGN KEY (ds) REFERENCES sp_distribution_set (id) ON DELETE CASCADE; +ALTER TABLE sp_target_attributes ADD CONSTRAINT fk_targ_attrib_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_target_target_tag ADD CONSTRAINT fk_targ_targtag_tag FOREIGN KEY (tag) REFERENCES sp_target_tag (id) ON DELETE CASCADE; +ALTER TABLE sp_target_target_tag ADD CONSTRAINT fk_targ_targtag_target FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_6__add_index___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_6__add_index___SQL_SERVER.sql index 9fdbca2f8..d7d7d6cc7 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_6__add_index___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_6__add_index___SQL_SERVER.sql @@ -1,2 +1,2 @@ -CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name); +CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name); CREATE INDEX sp_idx_distribution_set_tag_01 ON sp_distributionset_tag (tenant, name); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_7__add_rollout_approval_fields___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_7__add_rollout_approval_fields___SQL_SERVER.sql index 23eaea3fd..18d86a1ee 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_7__add_rollout_approval_fields___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_7__add_rollout_approval_fields___SQL_SERVER.sql @@ -1,4 +1,2 @@ -ALTER TABLE sp_rollout - ADD approval_decided_by varchar(40); -ALTER TABLE sp_rollout - ADD approval_remark varchar(255); \ No newline at end of file +ALTER TABLE sp_rollout ADD approval_decided_by varchar(40); +ALTER TABLE sp_rollout ADD approval_remark varchar(255); \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_9__add_target_metadata___SQL_SERVER.sql b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_9__add_target_metadata___SQL_SERVER.sql index 2d3795c8c..baa8cf292 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_9__add_target_metadata___SQL_SERVER.sql +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/db/migration/SQL_SERVER/V1_12_9__add_target_metadata___SQL_SERVER.sql @@ -1,10 +1,9 @@ CREATE TABLE sp_target_metadata ( - meta_key VARCHAR(128) NOT NULL, - meta_value VARCHAR(4000) NULL, - target_id NUMERIC(19) NOT NULL, - PRIMARY KEY (meta_key, target_id) + meta_key VARCHAR(128) NOT NULL, + meta_value VARCHAR(4000) NULL, + target_id NUMERIC(19) NOT NULL, + PRIMARY KEY (meta_key, target_id) ); -ALTER TABLE sp_target_metadata - ADD CONSTRAINT fk_metadata_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_target_metadata ADD CONSTRAINT fk_metadata_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE; diff --git a/intellij_codeformatter.xml b/intellij_codeformatter.xml index dbbcabc9e..3fa4132c6 100644 --- a/intellij_codeformatter.xml +++ b/intellij_codeformatter.xml @@ -38,6 +38,9 @@ + +