Rollback migration SQL files, accidently formatted (#1956)

This leads to problems with flyway

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-07 10:38:09 +02:00
committed by GitHub
parent 64c7feded3
commit 26e68c9d2c
134 changed files with 2906 additions and 3348 deletions

View File

@@ -1,2 +1 @@
ALTER TABLE sp_target_attributes
ALTER COLUMN attribute_key SET DATA TYPE VARCHAR(128);
ALTER TABLE sp_target_attributes ALTER COLUMN attribute_key SET DATA TYPE VARCHAR(128);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_target_filter_query
ADD COLUMN auto_assign_action_type INTEGER;
ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_action_type INTEGER;

View File

@@ -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);

View File

@@ -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);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_artifact
ADD COLUMN sha256_hash CHAR(64);
ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64);

View File

@@ -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;

View File

@@ -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);

View File

@@ -23,15 +23,10 @@ CREATE TABLE sp_target_type_ds_type_relation
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;
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;

View File

@@ -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;
UPDATE sp_distribution_set SET valid = 1;

View File

@@ -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;
UPDATE sp_base_software_module SET encrypted = 0;

View File

@@ -1,2 +1 @@
ALTER TABLE sp_target_type
ALTER COLUMN name SET DATA TYPE VARCHAR(128);
ALTER TABLE sp_target_type ALTER COLUMN name SET DATA TYPE VARCHAR(128);

View File

@@ -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);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_action
ADD COLUMN last_action_status_code INTEGER;
ALTER TABLE sp_action ADD COLUMN last_action_status_code INTEGER;

View File

@@ -1,12 +1,8 @@
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
(

View File

@@ -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);
ALTER TABLE sp_target_filter_query ADD COLUMN access_control_context VARCHAR(4096);
ALTER TABLE sp_rollout ADD COLUMN access_control_context VARCHAR(4096);

View File

@@ -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);
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);

View File

@@ -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;

View File

@@ -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;
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;

View File

@@ -1,13 +1,13 @@
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,
@@ -27,7 +27,7 @@ CREATE TABLE sp_action
maintenance_duration VARCHAR(40),
maintenance_time_zone VARCHAR(40),
PRIMARY KEY (id)
);
);
CREATE INDEX sp_idx_action_01
ON sp_action (tenant, distribution_set);
@@ -39,7 +39,7 @@ 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,
@@ -51,7 +51,7 @@ CREATE TABLE sp_action_status
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);
@@ -60,7 +60,7 @@ 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,
@@ -74,7 +74,7 @@ CREATE TABLE sp_artifact
file_size BIGINT,
software_module BIGINT NOT NULL,
PRIMARY KEY (id)
);
);
CREATE INDEX sp_idx_artifact_01
ON sp_artifact (tenant, software_module);
@@ -86,7 +86,7 @@ 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,
@@ -102,7 +102,7 @@ CREATE TABLE sp_distribution_set
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);
@@ -111,15 +111,15 @@ 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_distributionset_tag
(
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
colour VARCHAR(16),
@@ -131,13 +131,13 @@ CREATE TABLE sp_distributionset_tag
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 TABLE sp_distribution_set_type
(
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
colour VARCHAR(16),
@@ -151,7 +151,7 @@ CREATE TABLE sp_distribution_set_type
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);
@@ -160,7 +160,7 @@ 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,
@@ -181,10 +181,10 @@ CREATE TABLE sp_rollout
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,
@@ -209,10 +209,10 @@ CREATE TABLE sp_rolloutgroup
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,
@@ -227,7 +227,7 @@ CREATE TABLE sp_base_software_module
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);
@@ -239,16 +239,16 @@ 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_software_module_type
(
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
colour VARCHAR(16),
@@ -263,7 +263,7 @@ CREATE TABLE sp_software_module_type
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);
@@ -272,7 +272,7 @@ 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),
@@ -292,7 +292,7 @@ CREATE TABLE sp_target
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);
@@ -307,7 +307,7 @@ 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,
@@ -319,10 +319,10 @@ CREATE TABLE sp_target_filter_query
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),
@@ -334,13 +334,13 @@ CREATE TABLE sp_target_tag
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 TABLE sp_tenant_configuration
(
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
created_at BIGINT NOT NULL,
@@ -351,10 +351,10 @@ CREATE TABLE sp_tenant_configuration
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,
@@ -364,137 +364,95 @@ CREATE TABLE sp_tenant
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 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 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_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_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;

View File

@@ -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);
ALTER TABLE sp_rollout ADD COLUMN approval_decided_by varchar(40);
ALTER TABLE sp_rollout ADD COLUMN approval_remark varchar(255);

View File

@@ -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);
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);

View File

@@ -6,5 +6,4 @@ CREATE TABLE sp_target_metadata
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;

View File

@@ -1,5 +1,5 @@
create table sp_action
(
create table sp_action (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -14,10 +14,9 @@ create table sp_action
distribution_set bigint,
target bigint,
primary key (id)
);
);
create table sp_action_status
(
create table sp_action_status (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -29,16 +28,14 @@ create table sp_action_status
status integer,
action bigint not null,
primary key (id)
);
);
create table sp_action_status_messages
(
create table sp_action_status_messages (
action_status_id bigint not null,
detail_message varchar(512)
);
);
create table sp_artifact
(
create table sp_artifact (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -53,10 +50,9 @@ create table sp_artifact
gridfs_file_name varchar(40),
software_module bigint not null,
primary key (id)
);
);
create table sp_base_software_module
(
create table sp_base_software_module (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -71,10 +67,9 @@ create table sp_base_software_module
vendor varchar(256),
module_type bigint not null,
primary key (id)
);
);
create table sp_distribution_set
(
create table sp_distribution_set (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -90,10 +85,9 @@ create table sp_distribution_set
required_migration_step boolean,
ds_id bigint not null,
primary key (id)
);
);
create table sp_distribution_set_type
(
create table sp_distribution_set_type (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -107,10 +101,9 @@ create table sp_distribution_set_type
deleted boolean,
type_key varchar(64) not null,
primary key (id)
);
);
create table sp_distributionset_tag
(
create table sp_distributionset_tag (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -122,40 +115,35 @@ create table sp_distributionset_tag
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
);
create table sp_ds_dstag
(
create table sp_ds_dstag (
ds bigint not null,
TAG bigint not null,
primary key (ds, TAG)
);
);
create table sp_ds_metadata
(
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
(
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
(
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
(
create table sp_external_artifact (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -170,10 +158,9 @@ create table sp_external_artifact
provider bigint not null,
software_module bigint not null,
primary key (id)
);
);
create table sp_external_provider
(
create table sp_external_provider (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -186,10 +173,9 @@ create table sp_external_provider
base_url varchar(512) not null,
default_url_suffix varchar(512),
primary key (id)
);
);
create table sp_software_module_type
(
create table sp_software_module_type (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -204,18 +190,16 @@ create table sp_software_module_type
type_key varchar(64) not null,
max_ds_assignments integer not null,
primary key (id)
);
);
create table sp_sw_metadata
(
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
(
create table sp_target (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -229,18 +213,16 @@ create table sp_target
sec_token varchar(128) not null,
assigned_distribution_set bigint,
primary key (id)
);
);
create table sp_target_attributes
(
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
(
create table sp_target_info (
target_id bigint not null,
install_date bigint,
ip_address varchar(46),
@@ -249,10 +231,9 @@ create table sp_target_info
update_status varchar(255) not null,
installed_distribution_set bigint,
primary key (target_id)
);
);
create table sp_target_tag
(
create table sp_target_tag (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -264,17 +245,15 @@ create table sp_target_tag
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
);
create table sp_target_target_tag
(
create table sp_target_target_tag (
target bigint not null,
tag bigint not null,
primary key (target, tag)
);
);
create table sp_tenant
(
create table sp_tenant (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -284,10 +263,9 @@ create table sp_tenant
tenant varchar(40) not null,
default_ds_type bigint not null,
primary key (id)
);
);
create table sp_tenant_configuration
(
create table sp_tenant_configuration (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -298,219 +276,219 @@ create table sp_tenant_configuration
conf_key varchar(128),
conf_value varchar(512),
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 index sp_idx_action_status_01 on sp_action_status (tenant, action);
create index sp_idx_action_status_01 on sp_action_status (tenant, action);
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 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 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_prim on sp_artifact (tenant, id);
create index sp_idx_artifact_prim on sp_artifact (tenant, id);
alter table sp_base_software_module
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_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);
alter table sp_distribution_set
alter table sp_distribution_set
add constraint uk_distrib_set unique (name, version, tenant);
create index sp_idx_distribution_set_01 on sp_distribution_set (tenant, deleted, name, complete);
create index sp_idx_distribution_set_01 on sp_distribution_set (tenant, deleted, name, complete);
create index sp_idx_distribution_set_02 on sp_distribution_set (tenant, required_migration_step);
create index sp_idx_distribution_set_02 on sp_distribution_set (tenant, required_migration_step);
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);
alter table sp_distribution_set_type
alter table sp_distribution_set_type
add constraint uk_dst_name unique (name, tenant);
alter table sp_distribution_set_type
alter table sp_distribution_set_type
add constraint uk_dst_key unique (type_key, tenant);
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);
alter table sp_distributionset_tag
alter table sp_distributionset_tag
add constraint uk_ds_tag unique (name, tenant);
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 index sp_idx_external_artifact_prim on sp_external_artifact (id, tenant);
create index sp_idx_external_artifact_prim on sp_external_artifact (id, tenant);
create index sp_idx_external_provider_prim on sp_external_provider (tenant, id);
create index sp_idx_external_provider_prim on sp_external_provider (tenant, id);
alter table sp_software_module_type
alter table sp_software_module_type
add constraint uk_smt_type_key unique (type_key, tenant);
alter table sp_software_module_type
alter table sp_software_module_type
add constraint uk_smt_name unique (name, tenant);
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);
alter table sp_target
alter table sp_target
add constraint uk_tenant_controller_id unique (controller_id, tenant);
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_02 on sp_target (tenant, name);
create index sp_idx_target_02 on sp_target (tenant, name);
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 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
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
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
alter table sp_tenant_configuration
add constraint uk_tenant_key unique (conf_key, tenant);
alter table sp_action
alter table sp_action
add constraint fk_action_ds
foreign key (distribution_set)
references sp_distribution_set;
alter table sp_action
alter table sp_action
add constraint fk_targ_act_hist_targ
foreign key (target)
references sp_target;
alter table sp_action_status
alter table sp_action_status
add constraint fk_act_stat_action
foreign key (action)
references sp_action;
alter table sp_action_status_messages
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
alter table sp_artifact
add constraint fk_assigned_sm
foreign key (software_module)
references sp_base_software_module;
alter table 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_distribution_set
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
alter table sp_ds_dstag
add constraint fk_ds_dstag_tag
foreign key (TAG)
references sp_distributionset_tag;
alter table sp_ds_dstag
alter table sp_ds_dstag
add constraint fk_ds_dstag_ds
foreign key (ds)
references sp_distribution_set;
alter table sp_ds_metadata
alter table sp_ds_metadata
add constraint fk_metadata_ds
foreign key (ds_id)
references sp_distribution_set;
alter table sp_ds_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
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
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
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
alter table sp_external_artifact
add constraint fk_art_to_ext_provider
foreign key (provider)
references sp_external_provider;
alter table sp_external_artifact
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
alter table sp_sw_metadata
add constraint fk_metadata_sw
foreign key (sw_id)
references sp_base_software_module;
alter table sp_target
alter table sp_target
add constraint fk_target_assign_ds
foreign key (assigned_distribution_set)
references sp_distribution_set;
alter table sp_target_attributes
alter table sp_target_attributes
add constraint fk_targ_attrib_target
foreign key (target_id)
references sp_target_info;
alter table 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
alter table sp_target_info
add constraint fk_targ_stat_targ
foreign key (target_id)
references sp_target;
alter table sp_target_target_tag
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
alter table sp_target_target_tag
add constraint fk_targ_targtag_target
foreign key (target)
references sp_target;
alter table sp_tenant
alter table sp_tenant
add constraint fk_tenant_md_default_ds_type
foreign key (default_ds_type)
references sp_distribution_set_type;

View File

@@ -1,4 +1,4 @@
ALTER TABLE sp_rolloutgroup
ADD COLUMN target_percentage FLOAT;
ALTER TABLE sp_rolloutgroup
ADD COLUMN target_filter VARCHAR(1024);
ADD COLUMN target_filter VARCHAR (1024);

View File

@@ -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;

View File

@@ -1,30 +1,16 @@
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 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);
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

View File

@@ -1,2 +1,2 @@
alter table sp_target_filter_query
alter table sp_target_filter_query
add constraint uk_tenant_custom_filter_name unique (name, tenant);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_sw_metadata
ADD COLUMN target_visible boolean;
ALTER TABLE sp_sw_metadata ADD COLUMN target_visible boolean;

View File

@@ -1,31 +1,22 @@
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
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
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
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

View File

@@ -1,2 +1 @@
ALTER TABLE sp_target_filter_query
ADD COLUMN auto_assign_action_type integer;
ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_action_type integer;

View File

@@ -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);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_artifact
ADD COLUMN sha256_hash CHAR(64);
ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;
UPDATE sp_distribution_set SET valid = 1;

View File

@@ -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;
UPDATE sp_base_software_module SET encrypted = 0;

View File

@@ -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);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_action
ADD column last_action_status_code integer;
ALTER TABLE sp_action ADD column last_action_status_code integer;

View File

@@ -1,12 +1,8 @@
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
(

View File

@@ -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);
ALTER TABLE sp_target_filter_query ADD COLUMN access_control_context VARCHAR(4096);
ALTER TABLE sp_rollout ADD COLUMN access_control_context VARCHAR(4096);

View File

@@ -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);
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);

View File

@@ -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;

View File

@@ -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;
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;

View File

@@ -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);

View File

@@ -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);
ALTER TABLE sp_rollout ADD column approval_decided_by varchar(40);
ALTER TABLE sp_rollout ADD column approval_remark varchar(255);

View File

@@ -1,5 +1,4 @@
create table sp_target_metadata
(
create table sp_target_metadata (
meta_key varchar(128) not null,
meta_value varchar(4000),
target_id bigint not null,

View File

@@ -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
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;
AND address != null;

View File

@@ -1,5 +1,4 @@
create table sp_target_filter_query
(
create table sp_target_filter_query (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),

View File

@@ -1,5 +1,4 @@
create table sp_rolloutgroup
(
create table sp_rolloutgroup (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -22,10 +21,9 @@ create table sp_rolloutgroup
rollout bigint,
total_targets bigint,
primary key (id)
);
);
create table sp_rollout
(
create table sp_rollout (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
@@ -44,64 +42,61 @@ create table sp_rollout
forced_time bigint,
total_targets bigint,
primary key (id)
);
);
create table sp_rollouttargetgroup
(
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_rollout_01 on sp_rollout (tenant, name);
create index sp_idx_rolloutgroup_01 on sp_rolloutgroup (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_action ADD COLUMN rollout bigint;
ALTER TABLE sp_action ADD COLUMN rolloutgroup bigint;
alter table sp_rollout
alter table sp_rollout
add constraint uk_rollout unique (name, tenant);
alter table sp_rolloutgroup
alter table sp_rolloutgroup
add constraint uk_rolloutgroup unique (name, rollout, tenant);
alter table sp_action
alter table sp_action
add constraint fk_action_rollout
foreign key (rollout)
references sp_rollout;
alter table sp_action
alter table sp_action
add constraint fk_action_rolloutgroup
foreign key (rolloutgroup)
references sp_rolloutgroup;
alter table sp_rollout
alter table sp_rollout
add constraint fk_rollout_ds
foreign key (distribution_set)
references sp_distribution_set;
alter table sp_rolloutgroup
alter table sp_rolloutgroup
add constraint fk_rolloutgroup_rollout
foreign key (rollout)
references sp_rollout
on delete cascade;
alter table sp_rolloutgroup
alter table sp_rolloutgroup
add constraint fk_rolloutgroup_rolloutgroup
foreign key (parent_id)
references sp_rolloutgroup
on delete cascade;
alter table sp_rollouttargetgroup
alter table sp_rollouttargetgroup
add constraint fk_rollouttargetgroup_target
foreign key (target_id)
references sp_target
on delete cascade;
alter table sp_rollouttargetgroup
alter table sp_rollouttargetgroup
add constraint fk_rollouttargetgroup_rolloutgroup
foreign key (rolloutgroup_id)
references sp_rolloutgroup

View File

@@ -1,3 +1 @@
Update sp_software_module_type
set max_ds_assignments = 1
where max_ds_assignments < 1;
Update sp_software_module_type set max_ds_assignments = 1 where max_ds_assignments < 1;

View File

@@ -3,6 +3,6 @@ ALTER TABLE sp_target_filter_query
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;
FOREIGN KEY (auto_assign_distribution_set)
REFERENCES sp_distribution_set
ON DELETE SET NULL;

View File

@@ -1,3 +1,2 @@
ALTER TABLE sp_rollout
ADD column rollout_groups_created BIGINT;
ALTER TABLE sp_rollout ADD column rollout_groups_created BIGINT;

View File

@@ -1,5 +1,5 @@
create table sp_action
(
create table sp_action (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -14,10 +14,9 @@ create table sp_action
distribution_set bigint,
target bigint,
primary key (id)
);
);
create table sp_action_status
(
create table sp_action_status (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -29,16 +28,14 @@ create table sp_action_status
status integer,
action bigint not null,
primary key (id)
);
);
create table sp_action_status_messages
(
create table sp_action_status_messages (
action_status_id bigint not null,
detail_message varchar(512)
);
);
create table sp_artifact
(
create table sp_artifact (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -53,10 +50,9 @@ create table sp_artifact
gridfs_file_name varchar(40),
software_module bigint not null,
primary key (id)
);
);
create table sp_base_software_module
(
create table sp_base_software_module (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -71,10 +67,9 @@ create table sp_base_software_module
vendor varchar(256),
module_type bigint not null,
primary key (id)
);
);
create table sp_distribution_set
(
create table sp_distribution_set (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -90,10 +85,9 @@ create table sp_distribution_set
required_migration_step bit,
ds_id bigint not null,
primary key (id)
);
);
create table sp_distribution_set_type
(
create table sp_distribution_set_type (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -107,10 +101,9 @@ create table sp_distribution_set_type
deleted bit,
type_key varchar(64) not null,
primary key (id)
);
);
create table sp_distributionset_tag
(
create table sp_distributionset_tag (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -122,40 +115,35 @@ create table sp_distributionset_tag
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
);
create table sp_ds_dstag
(
create table sp_ds_dstag (
ds bigint not null,
TAG bigint not null,
primary key (ds, TAG)
);
);
create table sp_ds_metadata
(
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
(
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
(
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
(
create table sp_external_artifact (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -170,10 +158,9 @@ create table sp_external_artifact
provider bigint not null,
software_module bigint not null,
primary key (id)
);
);
create table sp_external_provider
(
create table sp_external_provider (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -186,10 +173,9 @@ create table sp_external_provider
base_url varchar(512) not null,
default_url_suffix varchar(512),
primary key (id)
);
);
create table sp_software_module_type
(
create table sp_software_module_type (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -204,18 +190,16 @@ create table sp_software_module_type
type_key varchar(64) not null,
max_ds_assignments integer not null,
primary key (id)
);
);
create table sp_sw_metadata
(
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
(
create table sp_target (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -229,18 +213,16 @@ create table sp_target
sec_token varchar(128) not null,
assigned_distribution_set bigint,
primary key (id)
);
);
create table sp_target_attributes
(
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
(
create table sp_target_info (
target_id bigint not null,
install_date bigint,
ip_address varchar(46),
@@ -249,10 +231,9 @@ create table sp_target_info
update_status varchar(255) not null,
installed_distribution_set bigint,
primary key (target_id)
);
);
create table sp_target_tag
(
create table sp_target_tag (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -264,17 +245,15 @@ create table sp_target_tag
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
);
create table sp_target_target_tag
(
create table sp_target_target_tag (
target bigint not null,
tag bigint not null,
primary key (target, tag)
);
);
create table sp_tenant
(
create table sp_tenant (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -284,10 +263,9 @@ create table sp_tenant
tenant varchar(40) not null,
default_ds_type bigint not null,
primary key (id)
);
);
create table sp_tenant_configuration
(
create table sp_tenant_configuration (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -298,219 +276,219 @@ create table sp_tenant_configuration
conf_key varchar(128),
conf_value varchar(512),
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 index sp_idx_action_status_01 on sp_action_status (tenant, action);
create index sp_idx_action_status_01 on sp_action_status (tenant, action);
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 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 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_prim on sp_artifact (tenant, id);
create index sp_idx_artifact_prim on sp_artifact (tenant, id);
alter table sp_base_software_module
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_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);
alter table sp_distribution_set
alter table sp_distribution_set
add constraint uk_distrib_set unique (name, version, tenant);
create index sp_idx_distribution_set_01 on sp_distribution_set (tenant, deleted, name, complete);
create index sp_idx_distribution_set_01 on sp_distribution_set (tenant, deleted, name, complete);
create index sp_idx_distribution_set_02 on sp_distribution_set (tenant, required_migration_step);
create index sp_idx_distribution_set_02 on sp_distribution_set (tenant, required_migration_step);
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);
alter table sp_distribution_set_type
alter table sp_distribution_set_type
add constraint uk_dst_name unique (name, tenant);
alter table sp_distribution_set_type
alter table sp_distribution_set_type
add constraint uk_dst_key unique (type_key, tenant);
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);
alter table sp_distributionset_tag
alter table sp_distributionset_tag
add constraint uk_ds_tag unique (name, tenant);
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 index sp_idx_external_artifact_prim on sp_external_artifact (id, tenant);
create index sp_idx_external_artifact_prim on sp_external_artifact (id, tenant);
create index sp_idx_external_provider_prim on sp_external_provider (tenant, id);
create index sp_idx_external_provider_prim on sp_external_provider (tenant, id);
alter table sp_software_module_type
alter table sp_software_module_type
add constraint uk_smt_type_key unique (type_key, tenant);
alter table sp_software_module_type
alter table sp_software_module_type
add constraint uk_smt_name unique (name, tenant);
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);
alter table sp_target
alter table sp_target
add constraint uk_tenant_controller_id unique (controller_id, tenant);
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_02 on sp_target (tenant, name);
create index sp_idx_target_02 on sp_target (tenant, name);
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 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
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
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
alter table sp_tenant_configuration
add constraint uk_tenant_key unique (conf_key, tenant);
alter table sp_action
alter table sp_action
add constraint fk_action_ds
foreign key (distribution_set)
references sp_distribution_set (id);
alter table sp_action
alter table sp_action
add constraint fk_targ_act_hist_targ
foreign key (target)
references sp_target (id);
alter table sp_action_status
alter table sp_action_status
add constraint fk_act_stat_action
foreign key (action)
references sp_action (id);
alter table sp_action_status_messages
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
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
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
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
alter table sp_ds_dstag
add constraint fk_ds_dstag_tag
foreign key (TAG)
references sp_distributionset_tag (id);
alter table sp_ds_dstag
alter table sp_ds_dstag
add constraint fk_ds_dstag_ds
foreign key (ds)
references sp_distribution_set (id);
alter table sp_ds_metadata
alter table sp_ds_metadata
add constraint fk_metadata_ds
foreign key (ds_id)
references sp_distribution_set (id);
alter table sp_ds_module
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
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
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
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
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
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
alter table sp_sw_metadata
add constraint fk_metadata_sw
foreign key (sw_id)
references sp_base_software_module (id);
alter table sp_target
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
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
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
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
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
alter table sp_target_target_tag
add constraint fk_targ_targtag_target
foreign key (target)
references sp_target (id);
alter table sp_tenant
alter table sp_tenant
add constraint fk_tenant_md_default_ds_type
foreign key (default_ds_type)
references sp_distribution_set_type (id);

View File

@@ -1,4 +1,4 @@
ALTER TABLE sp_rolloutgroup
ADD COLUMN target_percentage FLOAT;
ALTER TABLE sp_rolloutgroup
ADD COLUMN target_filter VARCHAR(1024);
ADD COLUMN target_filter VARCHAR (1024);

View File

@@ -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);

View File

@@ -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;

View File

@@ -1,19 +1,15 @@
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;

View File

@@ -1,2 +1,2 @@
alter table sp_target_filter_query
alter table sp_target_filter_query
add constraint uk_tenant_custom_filter_name unique (name, tenant);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_sw_metadata
ADD COLUMN target_visible bit;
ALTER TABLE sp_sw_metadata ADD COLUMN target_visible bit;

View File

@@ -1,31 +1,22 @@
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
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
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
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

View File

@@ -1 +1 @@
ALTER TABLE sp_target_attributes MODIFY attribute_key VARCHAR (128);
ALTER TABLE sp_target_attributes MODIFY attribute_key VARCHAR(128);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_target_filter_query
ADD COLUMN auto_assign_action_type integer;
ALTER TABLE sp_target_filter_query ADD COLUMN auto_assign_action_type integer;

View File

@@ -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);

View File

@@ -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);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_artifact
ADD COLUMN sha256_hash CHAR(64);
ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;
UPDATE sp_distribution_set SET valid = 1;

View File

@@ -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;
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;

View File

@@ -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;
UPDATE sp_base_software_module SET encrypted = 0;

View File

@@ -1 +1 @@
ALTER TABLE sp_target_type MODIFY name VARCHAR (128);
ALTER TABLE sp_target_type MODIFY name VARCHAR(128);

View File

@@ -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);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_action
ADD COLUMN last_action_status_code integer;
ALTER TABLE sp_action ADD COLUMN last_action_status_code integer;

View File

@@ -1,12 +1,8 @@
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
(

View File

@@ -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);
ALTER TABLE sp_target_filter_query ADD COLUMN access_control_context VARCHAR(4096);
ALTER TABLE sp_rollout ADD COLUMN access_control_context VARCHAR(4096);

View File

@@ -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);
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);

View File

@@ -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;

View File

@@ -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;
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;

View File

@@ -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);

View File

@@ -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);
ALTER TABLE sp_rollout ADD column approval_decided_by varchar(40);
ALTER TABLE sp_rollout ADD column approval_remark varchar(255);

View File

@@ -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);
ALTER TABLE sp_tenant_configuration MODIFY created_by VARCHAR(64), MODIFY last_modified_by VARCHAR(64);

View File

@@ -1,5 +1,4 @@
create table sp_target_metadata
(
create table sp_target_metadata (
meta_key varchar(128) not null,
meta_value varchar(4000),
target_id bigint not null,

View File

@@ -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

View File

@@ -1,5 +1,4 @@
create table sp_target_filter_query
(
create table sp_target_filter_query (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -10,7 +9,7 @@ create table sp_target_filter_query
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 index sp_idx_target_filter_query_01 on sp_target_filter_query (tenant, name);

View File

@@ -1,5 +1,4 @@
create table sp_rolloutgroup
(
create table sp_rolloutgroup (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -22,10 +21,9 @@ create table sp_rolloutgroup
rollout bigint,
total_targets bigint,
primary key (id)
);
);
create table sp_rollout
(
create table sp_rollout (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
@@ -44,64 +42,61 @@ create table sp_rollout
forced_time bigint,
total_targets bigint,
primary key (id)
);
);
create table sp_rollouttargetgroup
(
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_rollout_01 on sp_rollout (tenant, name);
create index sp_idx_rolloutgroup_01 on sp_rolloutgroup (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_action ADD COLUMN rollout bigint;
ALTER TABLE sp_action ADD COLUMN rolloutgroup bigint;
alter table sp_rollout
alter table sp_rollout
add constraint uk_rollout unique (name, tenant);
alter table sp_rolloutgroup
alter table sp_rolloutgroup
add constraint uk_rolloutgroup unique (name, rollout, tenant);
alter table sp_action
alter table sp_action
add constraint fk_action_rollout
foreign key (rollout)
references sp_rollout (id);
alter table sp_action
alter table sp_action
add constraint fk_action_rolloutgroup
foreign key (rolloutgroup)
references sp_rolloutgroup (id);
alter table sp_rollout
alter table sp_rollout
add constraint fk_rollout_ds
foreign key (distribution_set)
references sp_distribution_set (id);
alter table sp_rolloutgroup
alter table sp_rolloutgroup
add constraint fk_rolloutgroup_rollout
foreign key (rollout)
references sp_rollout (id)
on delete cascade;
alter table sp_rolloutgroup
alter table sp_rolloutgroup
add constraint fk_rolloutgroup_rolloutgroup
foreign key (parent_id)
references sp_rolloutgroup (id)
on delete cascade;
alter table sp_rollouttargetgroup
alter table sp_rollouttargetgroup
add constraint fk_rollouttargetgroup_target
foreign key (target_id)
references sp_target (id)
on delete cascade;
alter table sp_rollouttargetgroup
alter table sp_rollouttargetgroup
add constraint fk_rollouttargetgroup_rolloutgroup
foreign key (rolloutgroup_id)
references sp_rolloutgroup (id)

View File

@@ -1,3 +1 @@
Update sp_software_module_type
set max_ds_assignments = 1
where max_ds_assignments < 1;
Update sp_software_module_type set max_ds_assignments = 1 where max_ds_assignments < 1;

View File

@@ -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;
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;

View File

@@ -3,6 +3,6 @@ ALTER TABLE sp_target_filter_query
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;
FOREIGN KEY (auto_assign_distribution_set)
REFERENCES sp_distribution_set (id)
ON DELETE SET NULL;

View File

@@ -1,3 +1,2 @@
ALTER TABLE sp_rollout
ADD column rollout_groups_created BIGINT;
ALTER TABLE sp_rollout ADD column rollout_groups_created BIGINT;

View File

@@ -77,8 +77,7 @@ NO CYCLE;
-- ------------ Write CREATE-TABLE-stage scripts -----------
CREATE TABLE sp_action
(
CREATE TABLE sp_action(
id BIGINT NOT NULL DEFAULT nextval('sp_action_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -101,11 +100,10 @@ CREATE TABLE sp_action
weight INTEGER
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_action_status
(
CREATE TABLE sp_action_status(
id BIGINT NOT NULL DEFAULT nextval('sp_action_status_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -118,20 +116,18 @@ CREATE TABLE sp_action_status
action BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_action_status_messages
(
CREATE TABLE sp_action_status_messages(
action_status_id BIGINT NOT NULL,
detail_message VARCHAR(512) NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_artifact
(
CREATE TABLE sp_artifact(
id BIGINT NOT NULL DEFAULT nextval('sp_artifact_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -147,11 +143,10 @@ CREATE TABLE sp_artifact
sha256_hash CHAR(64)
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_base_software_module
(
CREATE TABLE sp_base_software_module(
id BIGINT NOT NULL DEFAULT nextval('sp_base_software_module_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -167,11 +162,10 @@ CREATE TABLE sp_base_software_module
module_type BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_distribution_set
(
CREATE TABLE sp_distribution_set(
id BIGINT NOT NULL DEFAULT nextval('sp_distribution_set_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -188,11 +182,10 @@ CREATE TABLE sp_distribution_set
ds_id BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_distribution_set_type
(
CREATE TABLE sp_distribution_set_type(
id BIGINT NOT NULL DEFAULT nextval('sp_distribution_set_type_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -207,11 +200,10 @@ CREATE TABLE sp_distribution_set_type
type_key VARCHAR(64) NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_distributionset_tag
(
CREATE TABLE sp_distributionset_tag(
id BIGINT NOT NULL DEFAULT nextval('sp_distributionset_tag_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -224,49 +216,44 @@ CREATE TABLE sp_distributionset_tag
colour VARCHAR(16)
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_ds_dstag
(
CREATE TABLE sp_ds_dstag(
ds BIGINT NOT NULL,
tag BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_ds_metadata
(
CREATE TABLE sp_ds_metadata(
meta_key VARCHAR(128) NOT NULL,
meta_value VARCHAR(4000),
ds_id BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_ds_module
(
CREATE TABLE sp_ds_module(
ds_id BIGINT NOT NULL,
module_id BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_ds_type_element
(
CREATE TABLE sp_ds_type_element(
mandatory BOOLEAN,
distribution_set_type BIGINT NOT NULL,
software_module_type BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_rollout
(
CREATE TABLE sp_rollout(
id BIGINT NOT NULL DEFAULT nextval('sp_rollout_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -292,11 +279,10 @@ CREATE TABLE sp_rollout
weight INTEGER
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_rolloutgroup
(
CREATE TABLE sp_rolloutgroup(
id BIGINT NOT NULL DEFAULT nextval('sp_rolloutgroup_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -322,20 +308,18 @@ CREATE TABLE sp_rolloutgroup
target_filter VARCHAR(1024)
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_rollouttargetgroup
(
CREATE TABLE sp_rollouttargetgroup(
target_id BIGINT NOT NULL,
rolloutgroup_id BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_software_module_type
(
CREATE TABLE sp_software_module_type(
id BIGINT NOT NULL DEFAULT nextval('sp_software_module_type_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -351,22 +335,20 @@ CREATE TABLE sp_software_module_type
max_ds_assignments INTEGER NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_sw_metadata
(
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
OIDS=FALSE
);
CREATE TABLE sp_target
(
CREATE TABLE sp_target(
id BIGINT NOT NULL DEFAULT nextval('sp_target_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -387,21 +369,19 @@ CREATE TABLE sp_target
update_status INTEGER NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_target_attributes
(
CREATE TABLE sp_target_attributes(
target_id BIGINT NOT NULL,
attribute_value VARCHAR(128),
attribute_key VARCHAR(128) NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_target_filter_query
(
CREATE TABLE sp_target_filter_query(
id BIGINT NOT NULL DEFAULT nextval('sp_target_filter_query_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -416,21 +396,19 @@ CREATE TABLE sp_target_filter_query
auto_assign_weight INTEGER
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_target_metadata
(
CREATE TABLE sp_target_metadata(
meta_key VARCHAR(128) NOT NULL,
meta_value VARCHAR(4000),
target_id BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_target_tag
(
CREATE TABLE sp_target_tag(
id BIGINT NOT NULL DEFAULT nextval('sp_target_tag_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -443,20 +421,18 @@ CREATE TABLE sp_target_tag
colour VARCHAR(16)
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_target_target_tag
(
CREATE TABLE sp_target_target_tag(
target BIGINT NOT NULL,
tag BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_tenant
(
CREATE TABLE sp_tenant(
id BIGINT NOT NULL DEFAULT nextval('sp_tenant_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -467,11 +443,10 @@ CREATE TABLE sp_tenant
default_ds_type BIGINT NOT NULL
)
WITH (
OIDS = FALSE
OIDS=FALSE
);
CREATE TABLE sp_tenant_configuration
(
CREATE TABLE sp_tenant_configuration(
id BIGINT NOT NULL DEFAULT nextval('sp_tenant_configuration_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -483,415 +458,415 @@ CREATE TABLE sp_tenant_configuration
conf_value VARCHAR(512) NOT NULL
)
WITH (
OIDS = FALSE
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;

View File

@@ -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);
ADD COLUMN auto_assign_initiated_by VARCHAR (64);

View File

@@ -1,3 +1,3 @@
CREATE INDEX sp_idx_target_05
ON sp_target
USING BTREE (tenant, last_modified_at);
ON sp_target
USING BTREE (tenant, last_modified_at);

View File

@@ -7,8 +7,7 @@ NO CYCLE;
-- ------------ Write CREATE-TABLE-stage scripts -----------
CREATE TABLE sp_target_type
(
CREATE TABLE sp_target_type(
id BIGINT NOT NULL DEFAULT nextval('sp_target_type_seq'),
created_at BIGINT,
created_by VARCHAR(64),
@@ -21,47 +20,46 @@ CREATE TABLE sp_target_type
colour VARCHAR(16)
)
WITH (
OIDS = FALSE
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
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;
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;

View File

@@ -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;
UPDATE sp_distribution_set SET valid = TRUE;

View File

@@ -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;
UPDATE sp_base_software_module SET encrypted = FALSE;

View File

@@ -1,3 +1,3 @@
CREATE INDEX sp_idx_rollout_status_tenant
ON sp_rollout
USING BTREE (tenant, status);
ON sp_rollout
USING BTREE (tenant, status);

View File

@@ -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);

View File

@@ -1,2 +1 @@
ALTER TABLE sp_action
ADD last_action_status_code INTEGER;
ALTER TABLE sp_action ADD last_action_status_code INTEGER;

View File

@@ -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
(

View File

@@ -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);
ALTER TABLE sp_target_filter_query ADD COLUMN access_control_context VARCHAR(4096);
ALTER TABLE sp_rollout ADD COLUMN access_control_context VARCHAR(4096);

Some files were not shown because too many files have changed in this diff Show More