Move Flyway into separate artifact (#2025)

Now it is not part of the ddi and dmf starters - only mgmt (where could be excluded on packaging)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-14 11:51:23 +02:00
committed by GitHub
parent 0d40837f9b
commit f62f9fa97b
175 changed files with 101 additions and 20 deletions

View File

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

View File

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

View File

@@ -1,13 +0,0 @@
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);

View File

@@ -1,4 +0,0 @@
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 +0,0 @@
ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64);

View File

@@ -1,3 +0,0 @@
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,3 +0,0 @@
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

@@ -1 +0,0 @@
CREATE INDEX sp_idx_target_05 ON sp_target (tenant, last_modified_at);

View File

@@ -1,32 +0,0 @@
CREATE TABLE sp_target_type
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
colour VARCHAR(16),
created_at BIGINT NOT NULL,
created_by VARCHAR(64) NOT NULL,
description VARCHAR(512),
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(64) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_target_type_prim
ON sp_target_type (tenant, id);
CREATE TABLE sp_target_type_ds_type_relation
(
target_type BIGINT NOT NULL,
distribution_set_type BIGINT NOT NULL,
PRIMARY KEY (target_type, distribution_set_type)
);
ALTER TABLE sp_target_type ADD CONSTRAINT uk_target_type_name UNIQUE (name, tenant);
ALTER TABLE sp_target 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;

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_distribution_set ADD COLUMN valid BOOLEAN;
UPDATE sp_distribution_set SET valid = 1;

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_base_software_module ADD COLUMN encrypted BOOLEAN;
UPDATE sp_base_software_module SET encrypted = 0;

View File

@@ -1 +0,0 @@
CREATE INDEX sp_idx_rollout_status_tenant ON sp_rollout (tenant, status);

View File

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

View File

@@ -1,2 +0,0 @@
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 +0,0 @@
ALTER TABLE sp_action ADD COLUMN last_action_status_code INTEGER;

View File

@@ -1,22 +0,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;
CREATE TABLE sp_target_conf_status
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
target_id bigint not null,
initiator VARCHAR(64),
remark VARCHAR(512),
created_at BIGINT,
created_by VARCHAR(64),
last_modified_at BIGINT,
last_modified_by VARCHAR(64),
optlock_revision BIGINT,
tenant VARCHAR(40) not null,
primary key (id)
);
ALTER TABLE sp_target_conf_status
ADD CONSTRAINT fk_target_auto_conf FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE;

View File

@@ -1,2 +0,0 @@
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,3 +0,0 @@
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,9 +0,0 @@
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;

View File

@@ -1,2 +0,0 @@
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,458 +0,0 @@
CREATE TABLE sp_ds_type_element
(
mandatory SMALLINT DEFAULT 0,
distribution_set_type BIGINT NOT NULL,
software_module_type BIGINT NOT NULL,
PRIMARY KEY (distribution_set_type, software_module_type)
);
CREATE TABLE sp_action
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
action_type INTEGER NOT NULL,
active SMALLINT DEFAULT 0,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
forced_time BIGINT,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
optlock_revision INTEGER,
status INTEGER NOT NULL,
distribution_set BIGINT NOT NULL,
rollout BIGINT,
rolloutgroup BIGINT,
target BIGINT NOT NULL,
maintenance_cron_schedule VARCHAR(40),
maintenance_duration VARCHAR(40),
maintenance_time_zone VARCHAR(40),
PRIMARY KEY (id)
);
CREATE 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_prim
ON sp_action (tenant, id);
CREATE TABLE sp_action_status
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
target_occurred_at BIGINT NOT NULL,
optlock_revision INTEGER,
status INTEGER NOT NULL,
action BIGINT NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_action_status_02
ON sp_action_status (tenant, action, status);
CREATE INDEX sp_idx_action_status_prim
ON sp_action_status (tenant, id);
CREATE TABLE sp_artifact
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
provided_file_name VARCHAR(256),
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
md5_hash VARCHAR(32),
optlock_revision INTEGER,
sha1_hash VARCHAR(40) NOT NULL,
file_size BIGINT,
software_module BIGINT NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_artifact_01
ON sp_artifact (tenant, software_module);
CREATE INDEX sp_idx_artifact_02
ON sp_artifact (tenant, sha1_hash);
CREATE INDEX sp_idx_artifact_prim
ON sp_artifact (tenant, id);
CREATE TABLE sp_distribution_set
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
complete SMALLINT DEFAULT 0,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
deleted SMALLINT DEFAULT 0,
description VARCHAR(512),
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
required_migration_step SMALLINT DEFAULT 0,
VERSION VARCHAR(64) NOT NULL,
ds_id BIGINT NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_distribution_set_01
ON sp_distribution_set (tenant, deleted, complete);
CREATE INDEX sp_idx_distribution_set_prim
ON sp_distribution_set (tenant, id);
CREATE TABLE sp_ds_metadata
(
meta_key VARCHAR(128) NOT NULL,
meta_value VARCHAR(4000),
ds_id BIGINT NOT NULL,
PRIMARY KEY (meta_key, ds_id)
);
CREATE TABLE sp_distributionset_tag
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
colour VARCHAR(16),
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
description VARCHAR(512),
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_distribution_set_tag_prim
ON sp_distributionset_tag (tenant, id);
CREATE TABLE sp_distribution_set_type
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
colour VARCHAR(16),
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
deleted SMALLINT DEFAULT 0,
description VARCHAR(512),
type_key VARCHAR(64) NOT NULL,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
PRIMARY KEY (id)
);
CREATE 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 TABLE sp_rollout
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
action_type INTEGER NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
deleted SMALLINT DEFAULT 0,
description VARCHAR(512),
forced_time BIGINT,
last_check BIGINT,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
rollout_groups_created INTEGER,
start_at BIGINT,
status INTEGER NOT NULL,
target_filter VARCHAR(1024) NOT NULL,
total_targets BIGINT,
distribution_set BIGINT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE sp_rolloutgroup
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
description VARCHAR(512),
error_action INTEGER,
error_action_exp VARCHAR(512),
error_condition INTEGER,
error_condition_exp VARCHAR(512),
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
status INTEGER NOT NULL,
success_action INTEGER NOT NULL,
success_action_exp VARCHAR(512),
success_condition INTEGER NOT NULL,
success_condition_exp VARCHAR(512) NOT NULL,
target_filter VARCHAR(1024),
target_percentage FLOAT,
total_targets INTEGER,
parent_id BIGINT,
rollout BIGINT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE sp_base_software_module
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
deleted SMALLINT DEFAULT 0,
description VARCHAR(512),
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
vendor VARCHAR(256),
VERSION VARCHAR(64) NOT NULL,
module_type BIGINT NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_base_sw_module_01
ON sp_base_software_module (tenant, deleted, name, VERSION);
CREATE INDEX sp_idx_base_sw_module_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 TABLE sp_sw_metadata
(
meta_key VARCHAR(128) NOT NULL,
target_visible SMALLINT DEFAULT 0,
meta_value VARCHAR(4000),
sw_id BIGINT NOT NULL,
PRIMARY KEY (meta_key, sw_id)
);
CREATE TABLE sp_software_module_type
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
colour VARCHAR(16),
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
deleted SMALLINT DEFAULT 0,
description VARCHAR(512),
type_key VARCHAR(64) NOT NULL,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
max_ds_assignments INTEGER NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_software_module_type_01
ON sp_software_module_type (tenant, deleted);
CREATE INDEX sp_idx_software_module_type_prim
ON sp_software_module_type (tenant, id);
CREATE TABLE sp_target
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
address VARCHAR(512),
controller_id VARCHAR(64) NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
description VARCHAR(512),
install_date BIGINT,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
last_target_query BIGINT,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
request_controller_attributes SMALLINT DEFAULT 0 NOT NULL,
sec_token VARCHAR(128) NOT NULL,
update_status INTEGER NOT NULL,
assigned_distribution_set BIGINT,
installed_distribution_set BIGINT,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_target_01
ON sp_target (tenant, name, assigned_distribution_set);
CREATE INDEX sp_idx_target_03
ON sp_target (tenant, controller_id, assigned_distribution_set);
CREATE INDEX sp_idx_target_04
ON sp_target (tenant, created_at);
CREATE INDEX sp_idx_target_prim
ON sp_target (tenant, id);
CREATE TABLE sp_target_filter_query
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
QUERY VARCHAR(1024) NOT NULL,
auto_assign_distribution_set BIGINT,
PRIMARY KEY (id)
);
CREATE TABLE sp_target_tag
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
colour VARCHAR(16),
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
description VARCHAR(512),
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
name VARCHAR(64) NOT NULL,
optlock_revision INTEGER,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_target_tag_prim
ON sp_target_tag (tenant, id);
CREATE TABLE sp_tenant_configuration
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
tenant VARCHAR(40) NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
conf_key VARCHAR(128) NOT NULL,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
optlock_revision INTEGER,
conf_value VARCHAR(512) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE sp_tenant
(
id BIGINT GENERATED always AS IDENTITY NOT NULL,
created_at BIGINT NOT NULL,
created_by VARCHAR(40) NOT NULL,
last_modified_at BIGINT NOT NULL,
last_modified_by VARCHAR(40) NOT NULL,
optlock_revision INTEGER,
tenant VARCHAR(40) NOT NULL,
default_ds_type BIGINT NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX sp_idx_tenant_prim
ON sp_tenant (tenant, id);
CREATE 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_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,2 +0,0 @@
CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name);
CREATE INDEX sp_idx_distribution_set_tag_01 ON sp_distributionset_tag (tenant, name);

View File

@@ -1,2 +0,0 @@
ALTER TABLE sp_rollout ADD COLUMN approval_decided_by varchar(40);
ALTER TABLE sp_rollout ADD COLUMN approval_remark varchar(255);

View File

@@ -1,45 +0,0 @@
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_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_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_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_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_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_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_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

@@ -1,9 +0,0 @@
CREATE TABLE sp_target_metadata
(
meta_key VARCHAR(128) NOT NULL,
meta_value VARCHAR(4000),
target_id BIGINT NOT NULL,
PRIMARY KEY (meta_key, target_id)
);
ALTER TABLE sp_target_metadata ADD CONSTRAINT fk_metadata_target FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE;

View File

@@ -1,494 +0,0 @@
create table sp_action (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
action_type varchar(255) not null,
active boolean,
forced_time bigint,
status integer,
distribution_set bigint,
target bigint,
primary key (id)
);
create table sp_action_status (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
target_occurred_at bigint,
status integer,
action bigint not null,
primary key (id)
);
create table sp_action_status_messages (
action_status_id bigint not null,
detail_message varchar(512)
);
create table sp_artifact (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
md5_hash varchar(32),
sha1_hash varchar(40),
file_size bigint,
provided_file_name varchar(256),
gridfs_file_name varchar(40),
software_module bigint not null,
primary key (id)
);
create table sp_base_software_module (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
version varchar(64) not null,
deleted boolean,
vendor varchar(256),
module_type bigint not null,
primary key (id)
);
create table sp_distribution_set (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
version varchar(64) not null,
complete boolean,
deleted boolean,
required_migration_step boolean,
ds_id bigint not null,
primary key (id)
);
create table sp_distribution_set_type (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
deleted boolean,
type_key varchar(64) not null,
primary key (id)
);
create table sp_distributionset_tag (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
create table sp_ds_dstag (
ds bigint not null,
TAG bigint not null,
primary key (ds, TAG)
);
create table sp_ds_metadata (
meta_key varchar(128) not null,
meta_value varchar(4000),
ds_id bigint not null,
primary key (ds_id, meta_key)
);
create table sp_ds_module (
ds_id bigint not null,
module_id bigint not null,
primary key (ds_id, module_id)
);
create table sp_ds_type_element (
mandatory boolean,
distribution_set_type bigint not null,
software_module_type bigint not null,
primary key (distribution_set_type, software_module_type)
);
create table sp_external_artifact (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
md5_hash varchar(32),
sha1_hash varchar(40),
file_size bigint,
url_suffix varchar(512),
provider bigint not null,
software_module bigint not null,
primary key (id)
);
create table sp_external_provider (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
base_url varchar(512) not null,
default_url_suffix varchar(512),
primary key (id)
);
create table sp_software_module_type (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
deleted boolean,
type_key varchar(64) not null,
max_ds_assignments integer not null,
primary key (id)
);
create table sp_sw_metadata (
meta_key varchar(128) not null,
meta_value varchar(4000),
sw_id bigint not null,
primary key (meta_key, sw_id)
);
create table sp_target (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
controller_id varchar(64),
sec_token varchar(128) not null,
assigned_distribution_set bigint,
primary key (id)
);
create table sp_target_attributes (
target_id bigint not null,
attribute_value varchar(128),
attribute_key varchar(32) not null,
primary key (target_id, attribute_key)
);
create table sp_target_info (
target_id bigint not null,
install_date bigint,
ip_address varchar(46),
last_target_query bigint,
request_controller_attributes boolean not null,
update_status varchar(255) not null,
installed_distribution_set bigint,
primary key (target_id)
);
create table sp_target_tag (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
create table sp_target_target_tag (
target bigint not null,
tag bigint not null,
primary key (target, tag)
);
create table sp_tenant (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
default_ds_type bigint not null,
primary key (id)
);
create table sp_tenant_configuration (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
conf_key varchar(128),
conf_value varchar(512),
primary key (id)
);
create index sp_idx_action_01 on sp_action (tenant, distribution_set);
create 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_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_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_artifact_01 on sp_artifact (tenant, software_module);
create index sp_idx_artifact_prim on sp_artifact (tenant, id);
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_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);
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_02 on sp_distribution_set (tenant, required_migration_step);
create index sp_idx_distribution_set_prim on sp_distribution_set (tenant, id);
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);
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);
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_external_artifact_prim on sp_external_artifact (id, tenant);
create index sp_idx_external_provider_prim on sp_external_provider (tenant, id);
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);
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);
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_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_04 on sp_target (tenant, created_at);
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_02 on sp_target_info (target_id, update_status);
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);
alter table sp_tenant
add constraint uk_tenantmd_tenant unique (tenant);
create index sp_idx_tenant_prim on sp_tenant (tenant, id);
alter table sp_tenant_configuration
add constraint uk_tenant_key unique (conf_key, tenant);
alter table sp_action
add constraint fk_action_ds
foreign key (distribution_set)
references sp_distribution_set;
alter table sp_action
add constraint fk_targ_act_hist_targ
foreign key (target)
references sp_target;
alter table sp_action_status
add constraint fk_act_stat_action
foreign key (action)
references sp_action;
alter table sp_action_status_messages
add constraint fk_stat_msg_act_stat
foreign key (action_status_id)
references sp_action_status;
alter table sp_artifact
add constraint fk_assigned_sm
foreign key (software_module)
references sp_base_software_module;
alter table sp_base_software_module
add constraint fk_module_type
foreign key (module_type)
references sp_software_module_type;
alter table sp_distribution_set
add constraint fk_ds_dstype_ds
foreign key (ds_id)
references sp_distribution_set_type;
alter table sp_ds_dstag
add constraint fk_ds_dstag_tag
foreign key (TAG)
references sp_distributionset_tag;
alter table sp_ds_dstag
add constraint fk_ds_dstag_ds
foreign key (ds)
references sp_distribution_set;
alter table sp_ds_metadata
add constraint fk_metadata_ds
foreign key (ds_id)
references sp_distribution_set;
alter table sp_ds_module
add constraint fk_ds_module_module
foreign key (module_id)
references sp_base_software_module;
alter table sp_ds_module
add constraint fk_ds_module_ds
foreign key (ds_id)
references sp_distribution_set;
alter table sp_ds_type_element
add constraint fk_ds_type_element_element
foreign key (distribution_set_type)
references sp_distribution_set_type;
alter table sp_ds_type_element
add constraint fk_ds_type_element_smtype
foreign key (software_module_type)
references sp_software_module_type;
alter table sp_external_artifact
add constraint fk_art_to_ext_provider
foreign key (provider)
references sp_external_provider;
alter table sp_external_artifact
add constraint fk_external_assigned_sm
foreign key (software_module)
references sp_base_software_module;
alter table sp_sw_metadata
add constraint fk_metadata_sw
foreign key (sw_id)
references sp_base_software_module;
alter table sp_target
add constraint fk_target_assign_ds
foreign key (assigned_distribution_set)
references sp_distribution_set;
alter table sp_target_attributes
add constraint fk_targ_attrib_target
foreign key (target_id)
references sp_target_info;
alter table sp_target_info
add constraint fk_target_inst_ds
foreign key (installed_distribution_set)
references sp_distribution_set;
alter table sp_target_info
add constraint fk_targ_stat_targ
foreign key (target_id)
references sp_target;
alter table sp_target_target_tag
add constraint fk_targ_targtag_tag
foreign key (tag)
references sp_target_tag;
alter table sp_target_target_tag
add constraint fk_targ_targtag_target
foreign key (target)
references sp_target;
alter table sp_tenant
add constraint fk_tenant_md_default_ds_type
foreign key (default_ds_type)
references sp_distribution_set_type;

View File

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

View File

@@ -1,4 +0,0 @@
ALTER TABLE sp_artifact DROP COLUMN sha1_hash;
ALTER TABLE sp_artifact ALTER COLUMN gridfs_file_name RENAME TO sha1_hash;
ALTER TABLE sp_artifact ALTER sha1_hash varchar(40) not null;
CREATE INDEX sp_idx_artifact_02 ON sp_artifact (tenant, sha1_hash);

View File

@@ -1,2 +0,0 @@
ALTER TABLE sp_rollout
ADD COLUMN start_at BIGINT;

View File

@@ -1,26 +0,0 @@
ALTER TABLE sp_rollout ADD COLUMN deleted BOOLEAN;
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;
ALTER TABLE sp_action ALTER status INTEGER NOT NULL;
ALTER TABLE sp_action_status ALTER status INTEGER NOT NULL;
ALTER TABLE sp_rollout ALTER status INTEGER NOT NULL;
ALTER TABLE sp_rollout ALTER distribution_set BIGINT NOT NULL;
ALTER TABLE sp_rolloutgroup ALTER rollout BIGINT NOT NULL;
ALTER TABLE sp_rolloutgroup ALTER status INTEGER NOT NULL;
ALTER TABLE sp_ds_type_element DROP CONSTRAINT fk_ds_type_element_element;
ALTER TABLE sp_ds_type_element
ADD CONSTRAINT fk_ds_type_element_element
FOREIGN KEY (distribution_set_type)
REFERENCES sp_distribution_set_type (id)
ON DELETE CASCADE;
ALTER TABLE sp_ds_type_element DROP CONSTRAINT fk_ds_type_element_smtype;
ALTER TABLE sp_ds_type_element
ADD CONSTRAINT fk_ds_type_element_smtype
FOREIGN KEY (software_module_type)
REFERENCES sp_software_module_type (id)
ON DELETE CASCADE;

View File

@@ -1,31 +0,0 @@
ALTER TABLE sp_target ADD COLUMN install_date bigint;
ALTER TABLE sp_target ADD COLUMN address varchar(512);
ALTER TABLE sp_target ADD COLUMN last_target_query bigint;
ALTER TABLE sp_target ADD COLUMN request_controller_attributes bit not null;
ALTER TABLE sp_target ADD COLUMN update_status varchar(16) not null;
ALTER TABLE sp_target ADD COLUMN installed_distribution_set bigint;
UPDATE sp_target t SET install_date=(SELECT i.install_date FROM sp_target_info i WHERE t.id = i.target_id);
UPDATE sp_target t SET address=(SELECT i.address FROM sp_target_info i WHERE t.id = i.target_id);
UPDATE sp_target t SET last_target_query=(SELECT i.last_target_query FROM sp_target_info i WHERE t.id = i.target_id);
UPDATE sp_target t SET request_controller_attributes=(SELECT i.request_controller_attributes FROM sp_target_info i WHERE t.id = i.target_id);
UPDATE sp_target t SET update_status=(SELECT i.update_status FROM sp_target_info i WHERE t.id = i.target_id);
UPDATE sp_target t SET installed_distribution_set=(SELECT i.installed_distribution_set FROM sp_target_info i WHERE t.id = i.target_id);
ALTER TABLE sp_target_attributes DROP CONSTRAINT fk_targ_attrib_target;
ALTER TABLE sp_target_attributes
ADD CONSTRAINT fk_targ_attrib_target
FOREIGN KEY (target_id)
REFERENCES sp_target (id)
ON DELETE cascade;
ALTER TABLE sp_target_info DROP CONSTRAINT fk_target_inst_ds;
ALTER TABLE sp_target
ADD CONSTRAINT fk_target_inst_ds
FOREIGN KEY (installed_distribution_set)
REFERENCES sp_distribution_set (id);
ALTER TABLE sp_target_info DROP CONSTRAINT fk_targ_stat_targ;
DROP INDEX sp_idx_target_info_02;
DROP TABLE sp_target_info;

View File

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

View File

@@ -1,8 +0,0 @@
DROP INDEX sp_idx_action_status_01;
DROP INDEX sp_idx_rollout_01;
DROP INDEX sp_idx_rolloutgroup_01;
DROP INDEX sp_idx_target_02;
DROP INDEX sp_idx_target_filter_query_01;
DROP INDEX sp_idx_distribution_set_01;
DROP INDEX sp_idx_distribution_set_02;
CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set (tenant, deleted, complete);

View File

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

View File

@@ -1,25 +0,0 @@
ALTER TABLE sp_action ADD COLUMN action_type_new integer not null;
UPDATE sp_action SET action_type_new =
CASE WHEN (action_type = 'SOFT') THEN 1
WHEN (action_type = 'TIMEFORCED') THEN 2
ELSE 0 END;
ALTER TABLE sp_action DROP COLUMN action_type;
ALTER TABLE sp_action ALTER COLUMN action_type_new RENAME TO action_type;
ALTER TABLE sp_rollout ADD COLUMN action_type_new integer not null;
UPDATE sp_rollout SET action_type_new =
CASE WHEN (action_type = 'SOFT') THEN 1
WHEN (action_type = 'TIMEFORCED') THEN 2
ELSE 0 END;
ALTER TABLE sp_rollout DROP COLUMN action_type;
ALTER TABLE sp_rollout ALTER COLUMN action_type_new RENAME to action_type;
ALTER TABLE sp_target ADD COLUMN update_status_new integer not null;
UPDATE sp_target SET update_status_new =
CASE WHEN (update_status = 'IN_SYNC') THEN 1
WHEN (update_status = 'PENDING') THEN 2
WHEN (update_status = 'ERROR') THEN 3
WHEN (update_status = 'REGISTERED') THEN 4
ELSE 0 END;
ALTER TABLE sp_target DROP COLUMN update_status;
ALTER TABLE sp_target ALTER COLUMN update_status_new RENAME TO update_status;

View File

@@ -1 +0,0 @@
ALTER TABLE sp_target_attributes ALTER COLUMN attribute_key VARCHAR(128);

View File

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

View File

@@ -1,13 +0,0 @@
ALTER TABLE sp_distribution_set ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_distribution_set_type ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_distributionset_tag ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_base_software_module ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_rollout ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_rolloutgroup ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_software_module_type ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_target ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_target_filter_query ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_target_tag ALTER COLUMN name VARCHAR(128);
ALTER TABLE sp_target ALTER COLUMN controller_id VARCHAR(256);

View File

@@ -1,4 +0,0 @@
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 +0,0 @@
ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64);

View File

@@ -1,3 +0,0 @@
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,2 +0,0 @@
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 +0,0 @@
CREATE INDEX sp_idx_target_05 ON sp_target (tenant, last_modified_at);

View File

@@ -1,50 +0,0 @@
create table sp_target_type
(
id bigint generated by default as identity,
created_at bigint,
created_by varchar(64),
last_modified_at bigint,
last_modified_by varchar(64),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
create table sp_target_type_ds_type_relation
(
target_type bigint not null,
distribution_set_type bigint not null,
primary key (target_type, distribution_set_type)
);
alter table sp_target_type
add constraint uk_target_type_name unique (name, tenant);
create index sp_idx_target_type_prim on sp_target_type (tenant, id);
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
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
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
on delete cascade;

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_distribution_set ADD COLUMN valid BOOLEAN;
UPDATE sp_distribution_set SET valid = 1;

View File

@@ -1,12 +0,0 @@
ALTER TABLE sp_action_status_messages ALTER detail_message varchar(512) not null;
ALTER TABLE sp_action ALTER distribution_set bigint not null;
ALTER TABLE sp_action ALTER target bigint not null;
ALTER TABLE sp_action ALTER status integer not null;
ALTER TABLE sp_action_status ALTER target_occurred_at bigint not null;
ALTER TABLE sp_action_status ALTER status integer not null;
ALTER TABLE sp_rollout ALTER distribution_set bigint not null;
ALTER TABLE sp_rollout ALTER status integer not null;
ALTER TABLE sp_rolloutgroup ALTER rollout bigint not null;
ALTER TABLE sp_rolloutgroup ALTER status integer not null;
ALTER TABLE sp_artifact ALTER sha1_hash varchar(40) not null;
ALTER TABLE sp_target ALTER controller_id varchar(64) not null;

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_base_software_module ADD COLUMN encrypted BOOLEAN;
UPDATE sp_base_software_module SET encrypted = 0;

View File

@@ -1 +0,0 @@
CREATE INDEX sp_idx_rollout_status_tenant ON sp_rollout (tenant, status);

View File

@@ -1 +0,0 @@
ALTER TABLE sp_target_type ALTER COLUMN name VARCHAR (128);

View File

@@ -1,2 +0,0 @@
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 +0,0 @@
ALTER TABLE sp_action ADD column last_action_status_code integer;

View File

@@ -1,22 +0,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;
create table sp_target_conf_status
(
id bigint not null auto_increment,
target_id bigint not null,
initiator varchar(64),
remark VARCHAR(512),
created_at bigint,
created_by varchar(64),
last_modified_at bigint,
last_modified_by varchar(64),
optlock_revision bigint,
tenant varchar(40) not null,
primary key (id)
);
ALTER TABLE sp_target_conf_status
ADD CONSTRAINT fk_target_auto_conf FOREIGN KEY (target_id) REFERENCES sp_target (id) ON DELETE CASCADE;

View File

@@ -1,2 +0,0 @@
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,3 +0,0 @@
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,9 +0,0 @@
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 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,2 +0,0 @@
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,3 +0,0 @@
ALTER TABLE sp_target ALTER update_status integer not null;
ALTER TABLE sp_rollout ALTER action_type integer not null;
ALTER TABLE sp_action ALTER action_type integer not null;

View File

@@ -1 +0,0 @@
alter table sp_rolloutgroup drop constraint fk_rolloutgroup_rolloutgroup;

View File

@@ -1,3 +0,0 @@
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,2 +0,0 @@
CREATE INDEX sp_idx_target_tag_01 ON sp_target_tag (tenant, name);
CREATE INDEX sp_idx_distribution_set_tag_01 ON sp_distributionset_tag (tenant, name);

View File

@@ -1,2 +0,0 @@
ALTER TABLE sp_rollout ADD column approval_decided_by varchar(40);
ALTER TABLE sp_rollout ADD column approval_remark varchar(255);

View File

@@ -1,45 +0,0 @@
ALTER TABLE sp_action ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_action ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_action_status ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_action_status ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_artifact ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_artifact ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_base_software_module ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_base_software_module ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_distributionset_tag ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_distributionset_tag ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_distribution_set ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_distribution_set ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_distribution_set_type ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_distribution_set_type ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_rollout ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_rollout ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_rollout ALTER COLUMN approval_decided_by VARCHAR(64);
ALTER TABLE sp_rolloutgroup ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_rolloutgroup ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_software_module_type ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_software_module_type ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_target ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_target ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_target_filter_query ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_target_filter_query ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_target_tag ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_target_tag ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_tenant ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_tenant ALTER COLUMN last_modified_by VARCHAR(64);
ALTER TABLE sp_tenant_configuration ALTER COLUMN created_by VARCHAR(64);
ALTER TABLE sp_tenant_configuration ALTER COLUMN last_modified_by VARCHAR(64);

View File

@@ -1,12 +0,0 @@
create table sp_target_metadata (
meta_key varchar(128) not null,
meta_value varchar(4000),
target_id bigint not null,
primary key (target_id, meta_key)
);
alter table sp_target_metadata
add constraint fk_metadata_target
foreign key (target_id)
references sp_target
on delete cascade;

View File

@@ -1,13 +0,0 @@
DROP INDEX sp_idx_target_info_01;
ALTER TABLE sp_target_info ALTER COLUMN ip_address RENAME TO address;
ALTER TABLE sp_target_info ALTER COLUMN address VARCHAR(512);
UPDATE sp_target_info
SET address = CONCAT('http://',(SELECT address
FROM sp_target_info i
WHERE sp_target_info.target_id = i.target_id))
WHERE EXISTS(SELECT target_id
FROM sp_target_info i
WHERE sp_target_info.target_id = i.target_id)
AND address != null;

View File

@@ -1,69 +0,0 @@
alter table sp_target_info drop constraint fk_targ_stat_targ;
alter table sp_target_info
add constraint fk_targ_stat_targ
foreign key (target_id)
references sp_target
on delete cascade;
alter table sp_action drop constraint fk_targ_act_hist_targ;
alter table sp_action
add constraint fk_targ_act_hist_targ
foreign key (target)
references sp_target
on delete cascade;
alter table sp_action_status drop constraint fk_act_stat_action;
alter table sp_action_status
add constraint fk_act_stat_action
foreign key (action)
references sp_action
on delete cascade;
alter table sp_sw_metadata drop constraint fk_metadata_sw;
alter table sp_sw_metadata
add constraint fk_metadata_sw
foreign key (sw_id)
references sp_base_software_module
on delete cascade;
alter table sp_ds_metadata drop constraint fk_metadata_ds;
alter table sp_ds_metadata
add constraint fk_metadata_ds
foreign key (ds_id)
references sp_distribution_set
on delete cascade;
alter table sp_action_status_messages drop constraint fk_stat_msg_act_stat;
alter table sp_action_status_messages
add constraint fk_stat_msg_act_stat
foreign key (action_status_id)
references sp_action_status
on delete cascade;
alter table sp_ds_dstag drop constraint fk_ds_dstag_tag;
alter table sp_ds_dstag
add constraint fk_ds_dstag_tag
foreign key (TAG)
references sp_distributionset_tag
on delete cascade;
alter table sp_ds_dstag drop constraint fk_ds_dstag_ds;
alter table sp_ds_dstag
add constraint fk_ds_dstag_ds
foreign key (ds)
references sp_distribution_set
on delete cascade;
alter table sp_target_target_tag drop constraint fk_targ_targtag_tag;
alter table sp_target_target_tag
add constraint fk_targ_targtag_tag
foreign key (tag)
references sp_target_tag
on delete cascade;
alter table sp_target_target_tag drop constraint fk_targ_targtag_target;
alter table sp_target_target_tag
add constraint fk_targ_targtag_target
foreign key (target)
references sp_target
on delete cascade;

View File

@@ -1,6 +0,0 @@
alter table sp_target_attributes drop constraint fk_targ_attrib_target;
alter table sp_target_attributes
add constraint fk_targ_attrib_target
foreign key (target_id)
references sp_target_info
on delete cascade;

View File

@@ -1,14 +0,0 @@
create table sp_target_filter_query (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
name varchar(64) not null,
query varchar(1024) not null,
primary key (id)
);
create index sp_idx_target_filter_query_01 on sp_target_filter_query (tenant, name);

View File

@@ -1,103 +0,0 @@
create table sp_rolloutgroup (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
error_condition integer,
error_condition_exp varchar(512),
error_action integer,
error_action_exp varchar(512),
success_condition integer not null,
success_condition_exp varchar(512) not null,
success_action integer not null,
success_action_exp varchar(512),
status integer,
parent_id bigint,
rollout bigint,
total_targets bigint,
primary key (id)
);
create table sp_rollout (
id bigint generated by default as identity,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
last_check bigint,
group_theshold float,
status integer,
distribution_set bigint,
target_filter varchar(1024),
action_type varchar(255) not null,
forced_time bigint,
total_targets bigint,
primary key (id)
);
create table sp_rollouttargetgroup (
target_Id bigint not null,
rolloutGroup_Id bigint not null,
primary key (rolloutGroup_Id, target_Id)
);
create index sp_idx_rollout_01 on sp_rollout (tenant, name);
create index sp_idx_rolloutgroup_01 on sp_rolloutgroup (tenant, name);
ALTER TABLE sp_action ADD COLUMN rollout bigint;
ALTER TABLE sp_action ADD COLUMN rolloutgroup bigint;
alter table sp_rollout
add constraint uk_rollout unique (name, tenant);
alter table sp_rolloutgroup
add constraint uk_rolloutgroup unique (name, rollout, tenant);
alter table sp_action
add constraint fk_action_rollout
foreign key (rollout)
references sp_rollout;
alter table sp_action
add constraint fk_action_rolloutgroup
foreign key (rolloutgroup)
references sp_rolloutgroup;
alter table sp_rollout
add constraint fk_rollout_ds
foreign key (distribution_set)
references sp_distribution_set;
alter table sp_rolloutgroup
add constraint fk_rolloutgroup_rollout
foreign key (rollout)
references sp_rollout
on delete cascade;
alter table sp_rolloutgroup
add constraint fk_rolloutgroup_rolloutgroup
foreign key (parent_id)
references sp_rolloutgroup
on delete cascade;
alter table sp_rollouttargetgroup
add constraint fk_rollouttargetgroup_target
foreign key (target_id)
references sp_target
on delete cascade;
alter table sp_rollouttargetgroup
add constraint fk_rollouttargetgroup_rolloutgroup
foreign key (rolloutgroup_id)
references sp_rolloutgroup
on delete cascade;

View File

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

View File

@@ -1,5 +0,0 @@
ALTER TABLE sp_target_info ALTER update_status VARCHAR(16) not null;
ALTER TABLE sp_action ALTER action_type VARCHAR(16) not null;
ALTER TABLE sp_rollout ALTER action_type VARCHAR(16) not null;
ALTER TABLE sp_tenant_configuration ALTER conf_key VARCHAR(128) not null;
ALTER TABLE sp_tenant_configuration ALTER conf_value VARCHAR(512) not null;

View File

@@ -1,8 +0,0 @@
ALTER TABLE sp_target_filter_query
ADD column auto_assign_distribution_set BIGINT;
ALTER TABLE sp_target_filter_query
ADD CONSTRAINT fk_filter_auto_assign_ds
FOREIGN KEY (auto_assign_distribution_set)
REFERENCES sp_distribution_set
ON DELETE SET NULL;

View File

@@ -1,27 +0,0 @@
alter table sp_ds_module drop constraint fk_ds_module_ds;
alter table sp_ds_module
add constraint fk_ds_module_ds
foreign key (ds_id)
references sp_distribution_set (id)
on delete cascade;
alter table sp_ds_module drop constraint fk_ds_module_module;
alter table sp_ds_module
add constraint fk_ds_module_module
foreign key (module_id)
references sp_base_software_module (id)
on delete cascade;
alter table sp_external_artifact drop constraint fk_external_assigned_sm;
alter table sp_external_artifact
add constraint fk_external_assigned_sm
foreign key (software_module)
references sp_base_software_module (id)
on delete cascade;
alter table sp_artifact drop constraint fk_assigned_sm;
alter table sp_artifact
add constraint fk_assigned_sm
foreign key (software_module)
references sp_base_software_module (id)
on delete cascade;

View File

@@ -1,2 +0,0 @@
DROP TABLE sp_external_artifact;
DROP TABLE sp_external_provider;

View File

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

View File

@@ -1,494 +0,0 @@
create table sp_action (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
action_type varchar(255) not null,
active bit,
forced_time bigint,
status integer,
distribution_set bigint,
target bigint,
primary key (id)
);
create table sp_action_status (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
target_occurred_at bigint,
status integer,
action bigint not null,
primary key (id)
);
create table sp_action_status_messages (
action_status_id bigint not null,
detail_message varchar(512)
);
create table sp_artifact (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
md5_hash varchar(32),
sha1_hash varchar(40),
file_size bigint,
provided_file_name varchar(256),
gridfs_file_name varchar(40),
software_module bigint not null,
primary key (id)
);
create table sp_base_software_module (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
version varchar(64) not null,
deleted bit,
vendor varchar(256),
module_type bigint not null,
primary key (id)
);
create table sp_distribution_set (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
version varchar(64) not null,
complete bit,
deleted bit,
required_migration_step bit,
ds_id bigint not null,
primary key (id)
);
create table sp_distribution_set_type (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
deleted bit,
type_key varchar(64) not null,
primary key (id)
);
create table sp_distributionset_tag (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
create table sp_ds_dstag (
ds bigint not null,
TAG bigint not null,
primary key (ds, TAG)
);
create table sp_ds_metadata (
meta_key varchar(128) not null,
meta_value varchar(4000),
ds_id bigint not null,
primary key (ds_id, meta_key)
);
create table sp_ds_module (
ds_id bigint not null,
module_id bigint not null,
primary key (ds_id, module_id)
);
create table sp_ds_type_element (
mandatory bit,
distribution_set_type bigint not null,
software_module_type bigint not null,
primary key (distribution_set_type, software_module_type)
);
create table sp_external_artifact (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
md5_hash varchar(32),
sha1_hash varchar(40),
file_size bigint,
url_suffix varchar(512),
provider bigint not null,
software_module bigint not null,
primary key (id)
);
create table sp_external_provider (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
base_url varchar(512) not null,
default_url_suffix varchar(512),
primary key (id)
);
create table sp_software_module_type (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
deleted bit,
type_key varchar(64) not null,
max_ds_assignments integer not null,
primary key (id)
);
create table sp_sw_metadata (
meta_key varchar(128) not null,
meta_value varchar(4000),
sw_id bigint not null,
primary key (meta_key, sw_id)
);
create table sp_target (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
controller_id varchar(64),
sec_token varchar(128) not null,
assigned_distribution_set bigint,
primary key (id)
);
create table sp_target_attributes (
target_id bigint not null,
attribute_value varchar(128),
attribute_key varchar(32) not null,
primary key (target_id, attribute_key)
);
create table sp_target_info (
target_id bigint not null,
install_date bigint,
ip_address varchar(46),
last_target_query bigint,
request_controller_attributes bit not null,
update_status varchar(255) not null,
installed_distribution_set bigint,
primary key (target_id)
);
create table sp_target_tag (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
create table sp_target_target_tag (
target bigint not null,
tag bigint not null,
primary key (target, tag)
);
create table sp_tenant (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
default_ds_type bigint not null,
primary key (id)
);
create table sp_tenant_configuration (
id bigint not null auto_increment,
created_at bigint,
created_by varchar(40),
last_modified_at bigint,
last_modified_by varchar(40),
optlock_revision bigint,
tenant varchar(40) not null,
conf_key varchar(128),
conf_value varchar(512),
primary key (id)
);
create index sp_idx_action_01 on sp_action (tenant, distribution_set);
create 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_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_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_artifact_01 on sp_artifact (tenant, software_module);
create index sp_idx_artifact_prim on sp_artifact (tenant, id);
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_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);
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_02 on sp_distribution_set (tenant, required_migration_step);
create index sp_idx_distribution_set_prim on sp_distribution_set (tenant, id);
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);
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);
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_external_artifact_prim on sp_external_artifact (id, tenant);
create index sp_idx_external_provider_prim on sp_external_provider (tenant, id);
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);
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);
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_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_04 on sp_target (tenant, created_at);
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_02 on sp_target_info (target_id, update_status);
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);
alter table sp_tenant
add constraint uk_tenantmd_tenant unique (tenant);
create index sp_idx_tenant_prim on sp_tenant (tenant, id);
alter table sp_tenant_configuration
add constraint uk_tenant_key unique (conf_key, tenant);
alter table sp_action
add constraint fk_action_ds
foreign key (distribution_set)
references sp_distribution_set (id);
alter table sp_action
add constraint fk_targ_act_hist_targ
foreign key (target)
references sp_target (id);
alter table sp_action_status
add constraint fk_act_stat_action
foreign key (action)
references sp_action (id);
alter table sp_action_status_messages
add constraint fk_stat_msg_act_stat
foreign key (action_status_id)
references sp_action_status (id);
alter table sp_artifact
add constraint fk_assigned_sm
foreign key (software_module)
references sp_base_software_module (id);
alter table sp_base_software_module
add constraint fk_module_type
foreign key (module_type)
references sp_software_module_type (id);
alter table sp_distribution_set
add constraint fk_ds_dstype_ds
foreign key (ds_id)
references sp_distribution_set_type (id);
alter table sp_ds_dstag
add constraint fk_ds_dstag_tag
foreign key (TAG)
references sp_distributionset_tag (id);
alter table sp_ds_dstag
add constraint fk_ds_dstag_ds
foreign key (ds)
references sp_distribution_set (id);
alter table sp_ds_metadata
add constraint fk_metadata_ds
foreign key (ds_id)
references sp_distribution_set (id);
alter table sp_ds_module
add constraint fk_ds_module_module
foreign key (module_id)
references sp_base_software_module (id);
alter table sp_ds_module
add constraint fk_ds_module_ds
foreign key (ds_id)
references sp_distribution_set (id);
alter table sp_ds_type_element
add constraint fk_ds_type_element_element
foreign key (distribution_set_type)
references sp_distribution_set_type (id);
alter table sp_ds_type_element
add constraint fk_ds_type_element_smtype
foreign key (software_module_type)
references sp_software_module_type (id);
alter table sp_external_artifact
add constraint fk_art_to_ext_provider
foreign key (provider)
references sp_external_provider (id);
alter table sp_external_artifact
add constraint fk_external_assigned_sm
foreign key (software_module)
references sp_base_software_module (id);
alter table sp_sw_metadata
add constraint fk_metadata_sw
foreign key (sw_id)
references sp_base_software_module (id);
alter table sp_target
add constraint fk_target_assign_ds
foreign key (assigned_distribution_set)
references sp_distribution_set (id);
alter table sp_target_attributes
add constraint fk_targ_attrib_target
foreign key (target_id)
references sp_target_info (target_id);
alter table sp_target_info
add constraint fk_target_inst_ds
foreign key (installed_distribution_set)
references sp_distribution_set (id);
alter table sp_target_info
add constraint fk_targ_stat_targ
foreign key (target_id)
references sp_target (id);
alter table sp_target_target_tag
add constraint fk_targ_targtag_tag
foreign key (tag)
references sp_target_tag (id);
alter table sp_target_target_tag
add constraint fk_targ_targtag_target
foreign key (target)
references sp_target (id);
alter table sp_tenant
add constraint fk_tenant_md_default_ds_type
foreign key (default_ds_type)
references sp_distribution_set_type (id);

View File

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

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_artifact DROP COLUMN sha1_hash;
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,2 +0,0 @@
ALTER TABLE sp_rollout
ADD COLUMN start_at BIGINT;

View File

@@ -1,26 +0,0 @@
ALTER TABLE sp_rollout ADD COLUMN deleted BOOLEAN;
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;
ALTER TABLE sp_action MODIFY status INTEGER NOT NULL;
ALTER TABLE sp_action_status MODIFY status INTEGER NOT NULL;
ALTER TABLE sp_rollout MODIFY status INTEGER NOT NULL;
ALTER TABLE sp_rollout MODIFY distribution_set BIGINT NOT NULL;
ALTER TABLE sp_rolloutgroup MODIFY rollout BIGINT NOT NULL;
ALTER TABLE sp_rolloutgroup MODIFY status INTEGER NOT NULL;
ALTER TABLE sp_ds_type_element DROP FOREIGN KEY fk_ds_type_element_element;
ALTER TABLE sp_ds_type_element
ADD CONSTRAINT fk_ds_type_element_element
FOREIGN KEY (distribution_set_type)
REFERENCES sp_distribution_set_type (id)
ON DELETE CASCADE;
ALTER TABLE sp_ds_type_element DROP FOREIGN KEY fk_ds_type_element_smtype;
ALTER TABLE sp_ds_type_element
ADD CONSTRAINT fk_ds_type_element_smtype
FOREIGN KEY (software_module_type)
REFERENCES sp_software_module_type (id)
ON DELETE CASCADE;

View File

@@ -1,31 +0,0 @@
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;
ALTER TABLE sp_target_info DROP INDEX sp_idx_target_info_02;
ALTER TABLE sp_target_attributes DROP FOREIGN KEY fk_targ_attrib_target;
ALTER TABLE sp_target_attributes
ADD CONSTRAINT fk_targ_attrib_target
FOREIGN KEY (target_id)
REFERENCES sp_target (id)
ON DELETE cascade;
ALTER TABLE sp_target_info DROP FOREIGN KEY fk_target_inst_ds;
ALTER TABLE sp_target
ADD CONSTRAINT fk_target_inst_ds
FOREIGN KEY (installed_distribution_set)
REFERENCES sp_distribution_set (id);
ALTER TABLE sp_target_info DROP FOREIGN KEY fk_targ_stat_targ;
DROP TABLE sp_target_info;

View File

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

View File

@@ -1,8 +0,0 @@
ALTER TABLE sp_action_status DROP INDEX sp_idx_action_status_01;
ALTER TABLE sp_rollout DROP INDEX sp_idx_rollout_01;
ALTER TABLE sp_rolloutgroup DROP INDEX sp_idx_rolloutgroup_01;
ALTER TABLE sp_target DROP INDEX sp_idx_target_02;
ALTER TABLE sp_target_filter_query DROP INDEX sp_idx_target_filter_query_01;
ALTER TABLE sp_distribution_set DROP INDEX sp_idx_distribution_set_01;
ALTER TABLE sp_distribution_set DROP INDEX sp_idx_distribution_set_02;
CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set (tenant, deleted, complete);

View File

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

View File

@@ -1,25 +0,0 @@
ALTER TABLE sp_action ADD COLUMN action_type_new integer not null;
UPDATE sp_action SET action_type_new =
CASE WHEN (action_type = 'SOFT') THEN 1
WHEN (action_type = 'TIMEFORCED') THEN 2
ELSE 0 END;
ALTER TABLE sp_action DROP COLUMN action_type;
ALTER TABLE sp_action CHANGE COLUMN action_type_new action_type integer;
ALTER TABLE sp_rollout ADD COLUMN action_type_new integer not null;
UPDATE sp_rollout SET action_type_new =
CASE WHEN (action_type = 'SOFT') THEN 1
WHEN (action_type = 'TIMEFORCED') THEN 2
ELSE 0 END;
ALTER TABLE sp_rollout DROP COLUMN action_type;
ALTER TABLE sp_rollout CHANGE COLUMN action_type_new action_type integer;
ALTER TABLE sp_target ADD COLUMN update_status_new integer not null;
UPDATE sp_target SET update_status_new =
CASE WHEN (update_status = 'IN_SYNC') THEN 1
WHEN (update_status = 'PENDING') THEN 2
WHEN (update_status = 'ERROR') THEN 3
WHEN (update_status = 'REGISTERED') THEN 4
ELSE 0 END;
ALTER TABLE sp_target DROP COLUMN update_status;
ALTER TABLE sp_target CHANGE COLUMN update_status_new update_status integer;

View File

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

View File

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

View File

@@ -1,13 +0,0 @@
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);

View File

@@ -1,4 +0,0 @@
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 +0,0 @@
ALTER TABLE sp_artifact ADD COLUMN sha256_hash CHAR(64);

View File

@@ -1,3 +0,0 @@
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,2 +0,0 @@
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 +0,0 @@
CREATE INDEX sp_idx_target_05 ON sp_target (tenant, last_modified_at);

View File

@@ -1,47 +0,0 @@
create table sp_target_type
(
id bigint not null auto_increment,
created_at bigint,
created_by varchar(64),
last_modified_at bigint,
last_modified_by varchar(64),
optlock_revision bigint,
tenant varchar(40) not null,
description varchar(512),
name varchar(64) not null,
colour varchar(16),
primary key (id)
);
create table sp_target_type_ds_type_relation
(
target_type bigint not null,
distribution_set_type bigint not null,
primary key (target_type, distribution_set_type)
);
alter table sp_target_type
add constraint uk_target_type_name unique (name, tenant);
create index sp_idx_target_type_prim on sp_target_type (tenant, id);
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;

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_distribution_set ADD COLUMN valid BOOLEAN;
UPDATE sp_distribution_set SET valid = 1;

View File

@@ -1,12 +0,0 @@
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;
ALTER TABLE sp_action_status CHANGE COLUMN target_occurred_at target_occurred_at bigint not null;
ALTER TABLE sp_action_status CHANGE COLUMN status status integer not null;
ALTER TABLE sp_rollout CHANGE COLUMN distribution_set distribution_set bigint not null;
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;

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_base_software_module ADD COLUMN encrypted BOOLEAN;
UPDATE sp_base_software_module SET encrypted = 0;

View File

@@ -1 +0,0 @@
CREATE INDEX sp_idx_rollout_status_tenant ON sp_rollout (tenant, status);

View File

@@ -1,2 +0,0 @@
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 +0,0 @@
ALTER TABLE sp_action ADD COLUMN last_action_status_code integer;

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