Remove DB migrations up to 1.0.0 baseline (#2953)

For the existing DBs the 0.10.0 release shall be applied before hawkbit 1.0.0!

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2026-03-09 16:58:31 +02:00
committed by GitHub
parent a752c72c01
commit a1608cce19
141 changed files with 0 additions and 3728 deletions

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,8 +0,0 @@
-- Table and fields in upper case as Spring queries it that way
CREATE TABLE SP_LOCK (
LOCK_KEY CHAR(36) NOT NULL,
REGION VARCHAR(100) NOT NULL,
CLIENT_ID CHAR(36),
CREATED_DATE TIMESTAMP NOT NULL,
constraint SP_LOCK_PK primary key (LOCK_KEY, REGION)
);

View File

@@ -1,2 +0,0 @@
alter table sp_distribution_set drop constraint uk_distrib_set;
alter table sp_distribution_set add constraint uk_distrib_set unique (tenant, name, version, ds_id);

View File

@@ -1,73 +0,0 @@
-- rename tables
alter table sp_base_software_module rename to sp_software_module;
alter table sp_distributionset_tag rename to sp_distribution_set_tag;
alter table sp_ds_dstag rename to sp_ds_tag;
alter table sp_ds_module rename to sp_ds_sm;
alter table sp_rolloutgroup rename to sp_rollout_group;
alter table sp_rollouttargetgroup rename to sp_rollout_target_group;
alter table sp_sw_metadata rename to sp_sm_metadata;
alter table sp_target_type_ds_type_relation rename to sp_target_type_ds_type;
-- rename columns
alter table sp_action rename column rolloutgroup to rollout_group;
alter table sp_action_status_messages rename column action_status_id to action_status;
alter table sp_distribution_set rename column ds_id to ds_type;
alter table sp_ds_sm rename column module_id to sm_id;
alter table sp_ds_metadata rename column ds_id to ds;
alter table sp_ds_tag rename column TAG to tag;
alter table sp_rollout_group rename column parent_id to parent;
alter table sp_rollout_target_group rename column target_id to target;
alter table sp_rollout_target_group rename column rolloutgroup_id to rollout_group;
alter table sp_sm_metadata rename column sw_id to sm;
alter table sp_software_module rename column module_type to sm_type;
alter table sp_target_attributes rename column target_id to target;
alter table sp_target_conf_status rename column target_id to target;
alter table sp_target_metadata rename column target_id to target;
-- rename constraints
alter table sp_action rename constraint fk_action_ds to fk_action_distribution_set;
alter table sp_action rename constraint fk_action_rolloutgroup to fk_action_rollout_group;
alter table sp_action rename constraint fk_targ_act_hist_targ to fk_action_target;
alter table sp_action_status rename constraint fk_act_stat_action to fk_action_status_action;
alter table sp_action_status_messages rename constraint fk_stat_msg_act_stat to fk_action_status_messages_action_status;
alter table sp_artifact rename constraint fk_assigned_sm to fk_artifact_software_module;
alter table sp_distribution_set rename constraint uk_distrib_set to uk_distribution_set;
alter table sp_distribution_set rename constraint fk_ds_dstype_ds to fk_distribution_set_ds_type;
alter table sp_distribution_set_tag rename constraint uk_ds_tag to uk_distribution_set_tag;
alter table sp_distribution_set_type rename constraint uk_dst_key to uk_distribution_set_type_type_key;
alter table sp_distribution_set_type rename constraint uk_dst_name to uk_distribution_set_type_name;
alter table sp_ds_metadata rename constraint fk_metadata_ds to fk_ds_metadata_ds;
alter table sp_ds_sm rename constraint fk_ds_module_ds to fk_ds_sm_ds_id;
alter table sp_ds_sm rename constraint fk_ds_module_module to fk_ds_sm_sm_id;
alter table sp_ds_tag rename constraint fk_ds_dstag_ds to fk_ds_tag_ds;
alter table sp_ds_tag rename constraint fk_ds_dstag_tag to fk_ds_tag_tag;
alter table sp_ds_type_element rename constraint fk_ds_type_element_element to fk_ds_type_element_distribution_set_type;
alter table sp_ds_type_element rename constraint fk_ds_type_element_smtype to fk_ds_type_element_software_module_type;
alter table sp_rollout rename constraint fk_rollout_ds to fk_rollout_distribution_set;
alter table sp_rollout_group rename constraint uk_rolloutgroup to uk_rollout_group;
alter table sp_rollout_group rename constraint fk_rolloutgroup_rollout to fk_rollout_group_rollout;
alter table sp_rollout_target_group rename constraint fk_rollouttargetgroup_rolloutgroup to fk_rollout_target_group_rollout_group;
alter table sp_sm_metadata rename constraint fk_metadata_sw to fk_sm_metadata_sm;
alter table sp_software_module rename constraint uk_base_sw_mod to uk_software_module;
alter table sp_software_module rename constraint fk_module_type to fk_software_module_sm_type;
alter table sp_software_module_type rename constraint uk_smt_type_key to uk_software_module_type_type_key;
alter table sp_software_module_type rename constraint uk_smt_name to uk_software_module_type_name;
alter table sp_rollout_target_group rename constraint fk_rollouttargetgroup_target to fk_rollout_target_group_target;
alter table sp_target rename constraint uk_tenant_controller_id to uk_target_controller_id;
alter table sp_target_attributes rename constraint fk_targ_attrib_target to fk_target_attributes_target;
alter table sp_target_conf_status rename constraint fk_target_auto_conf to fk_target_conf_status_target;
alter table sp_target_filter_query rename constraint uk_tenant_custom_filter_name to uk_target_filter_query;
alter table sp_target_filter_query rename constraint fk_filter_auto_assign_ds to fk_target_filter_query_auto_assign_distribution_set;
alter table sp_target_metadata rename constraint fk_metadata_target to fk_target_metadata_target;
alter table sp_target_tag rename constraint uk_targ_tag to uk_target_tag;
alter table sp_target_target_tag rename constraint fk_targ_targtag_target to fk_target_target_tag_target;
alter table sp_target_target_tag rename constraint fk_targ_targtag_tag to fk_target_target_tag_tag;
alter table sp_target_type rename constraint uk_target_type_name to uk_target_name;
alter table sp_target_type_ds_type rename constraint fk_target_type_relation_target_type to fk_target_type_ds_type_target_type;
alter table sp_target_type_ds_type rename constraint fk_target_type_relation_ds_type to fk_target_type_ds_type_distribution_set_type;
alter table sp_tenant rename constraint uk_tenantmd_tenant to uk_tenant;
alter table sp_tenant rename constraint fk_tenant_md_default_ds_type to fk_sp_tenant_default_ds_type;
alter table sp_tenant_configuration rename constraint uk_tenant_key to uk_tenant_configuration;
-- rename indexes
alter index sp_idx_action_status_msgs_01 rename to fk_action_status_messages_action_status;
alter index sp_idx_base_sw_module_prim rename to sp_idx_software_module_prim;
alter index sp_idx_base_sw_module_01 rename to sp_idx_software_module_01;
alter index sp_idx_base_sw_module_02 rename to sp_idx_software_module_02;

View File

@@ -1,2 +0,0 @@
ALTER TABLE sp_target ADD COLUMN target_group VARCHAR(256);
CREATE INDEX sp_idx_target_group ON sp_target (tenant, target_group);

View File

@@ -1,4 +0,0 @@
ALTER TABLE sp_software_module_type ADD COLUMN min_artifacts integer default 0 NOT NULL;
DROP INDEX sp_idx_distribution_set_01;
CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set (tenant, deleted);
ALTER TABLE sp_distribution_set DROP COLUMN complete;

View File

@@ -1,4 +0,0 @@
DELETE FROM sp_tenant_configuration WHERE conf_key='action.cleanup.enabled';
UPDATE sp_tenant_configuration SET conf_key='action.cleanup.auto.expiry' WHERE conf_key='action.cleanup.actionExpiry';
UPDATE sp_tenant_configuration SET conf_key='action.cleanup.auto.status' WHERE conf_key='action.cleanup.actionStatus';
UPDATE sp_tenant_configuration SET conf_key='actions.cleanup.onQuotaHit.percent' WHERE conf_key='action.cleanup.onQuotaHit.percent';

View File

@@ -1,8 +0,0 @@
-- remove unnecessary / faulty default for a tenant's scope unique key
ALTER TABLE sp_target_type ALTER COLUMN type_key DROP DEFAULT;
-- remove unused column
ALTER TABLE sp_rollout DROP COLUMN group_theshold;
-- rename index
ALTER TABLE sp_tenant RENAME CONSTRAINT fk_sp_tenant_default_ds_type TO fk_tenant_default_ds_type;

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_tenant_configuration ALTER COLUMN conf_value CLOB NOT NULL;
ALTER TABLE sp_target_filter_query ALTER COLUMN access_control_context CLOB;
ALTER TABLE sp_rollout ALTER COLUMN access_control_context CLOB;

View File

@@ -1 +0,0 @@
CREATE INDEX sp_idx_rollout_group_parent ON sp_rollout_group (parent);

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,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_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;

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 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,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 CHANGE COLUMN update_status update_status integer not null;
ALTER TABLE sp_rollout CHANGE COLUMN action_type action_type integer not null;
ALTER TABLE sp_action CHANGE COLUMN action_type action_type integer not null;

View File

@@ -1,8 +0,0 @@
-- Table and fields in upper case as Spring queries it that way
CREATE TABLE SP_LOCK (
LOCK_KEY CHAR(36) NOT NULL,
REGION VARCHAR(100) NOT NULL,
CLIENT_ID CHAR(36),
CREATED_DATE DATETIME(6) NOT NULL,
constraint SP_LOCK_PK primary key (LOCK_KEY, REGION)
);

View File

@@ -1,2 +0,0 @@
alter table sp_distribution_set drop constraint uk_distrib_set;
alter table sp_distribution_set add constraint uk_distrib_set unique (tenant, name, version, ds_id);

View File

@@ -1,63 +0,0 @@
-- rename tables
alter table sp_base_software_module rename to sp_software_module;
alter table sp_distributionset_tag rename to sp_distribution_set_tag;
alter table sp_ds_dstag rename to sp_ds_tag;
alter table sp_ds_module rename to sp_ds_sm;
alter table sp_rolloutgroup rename to sp_rollout_group;
alter table sp_rollouttargetgroup rename to sp_rollout_target_group;
alter table sp_sw_metadata rename to sp_sm_metadata;
alter table sp_target_type_ds_type_relation rename to sp_target_type_ds_type;
-- rename columns
alter table sp_action rename column rolloutgroup to rollout_group;
alter table sp_action_status_messages rename column action_status_id to action_status;
alter table sp_distribution_set rename column ds_id to ds_type;
alter table sp_ds_sm rename column module_id to sm_id;
alter table sp_ds_metadata rename column ds_id to ds;
alter table sp_ds_tag rename column TAG to tag;
alter table sp_rollout_group rename column parent_id to parent;
alter table sp_rollout_target_group rename column target_id to target;
alter table sp_rollout_target_group rename column rolloutgroup_id to rollout_group;
alter table sp_sm_metadata rename column sw_id to sm;
alter table sp_software_module rename column module_type to sm_type;
alter table sp_target_attributes rename column target_id to target;
alter table sp_target_conf_status rename column target_id to target;
alter table sp_target_metadata rename column target_id to target;
-- rename constraints
-- rename indexes
alter table sp_action rename index fk_action_ds to fk_action_distribution_set;
alter table sp_action rename index fk_action_rolloutgroup to fk_action_rollout_group;
alter table sp_action rename index fk_targ_act_hist_targ to fk_action_target;
alter table sp_action_status rename index fk_act_stat_action to fk_action_status_action;
alter table sp_action_status_messages rename index sp_idx_action_status_msgs_01 to fk_action_status_messages_action_status;
alter table sp_artifact rename index fk_assigned_sm to fk_artifact_software_module;
alter table sp_distribution_set rename index uk_distrib_set to uk_distribution_set;
alter table sp_distribution_set rename index fk_ds_dstype_ds to fk_distribution_set_ds_type;
alter table sp_distribution_set_tag rename index uk_ds_tag to uk_distribution_set_tag;
alter table sp_distribution_set_type rename index uk_dst_key to uk_distribution_set_type_type_key;
alter table sp_distribution_set_type rename index uk_dst_name to uk_distribution_set_type_name;
alter table sp_ds_sm rename index fk_ds_module_module to fk_ds_sm_sm_id;
alter table sp_ds_tag rename index fk_ds_dstag_tag to fk_ds_tag_tag;
alter table sp_ds_type_element rename index fk_ds_type_element_smtype to fk_ds_type_element_software_module_type;
alter table sp_rollout rename index fk_rollout_ds to fk_rollout_distribution_set;
alter table sp_rollout_group rename index uk_rolloutgroup to uk_rollout_group;
alter table sp_rollout_group rename index fk_rolloutgroup_rollout to fk_rollout_group_rollout;
alter table sp_rollout_group rename index fk_rolloutgroup_rolloutgroup to sp_idx_rollout_group_parent;
alter table sp_rollout_target_group rename index fk_rollouttargetgroup_target to fk_rollout_target_group_target;
alter table sp_sm_metadata rename index fk_metadata_sw to fk_sm_metadata_sm;
alter table sp_software_module rename index uk_base_sw_mod to uk_software_module;
alter table sp_software_module_type rename index uk_smt_type_key to uk_software_module_type_type_key;
alter table sp_software_module_type rename index uk_smt_name to uk_software_module_type_name;
alter table sp_software_module rename index sp_idx_base_sw_module_prim to sp_idx_software_module_prim;
alter table sp_software_module rename index sp_idx_base_sw_module_01 to sp_idx_software_module_01;
alter table sp_software_module rename index sp_idx_base_sw_module_02 to sp_idx_software_module_02;
alter table sp_target rename index uk_tenant_controller_id to uk_target_controller_id;
alter table sp_target_conf_status rename index fk_target_auto_conf to fk_target_conf_status_target;
alter table sp_target_filter_query rename index uk_tenant_custom_filter_name to uk_target_filter_query;
alter table sp_target_filter_query rename index fk_filter_auto_assign_ds to fk_target_filter_query_auto_assign_distribution_set;
alter table sp_target_tag rename index uk_targ_tag to uk_target_tag;
alter table sp_target_target_tag rename index fk_targ_targtag_tag to fk_target_target_tag_tag;
alter table sp_target_type rename index uk_target_type_name to uk_target_name;
alter table sp_target_type_ds_type rename index fk_target_type_relation_ds_type to fk_target_type_ds_type_distribution_set_type;
alter table sp_tenant rename index uk_tenantmd_tenant to uk_tenant;
alter table sp_tenant rename index fk_tenant_md_default_ds_type to fk_tenant_default_ds_type;
alter table sp_tenant_configuration rename index uk_tenant_key to uk_tenant_configuration;

View File

@@ -1,2 +0,0 @@
ALTER TABLE sp_target ADD COLUMN target_group VARCHAR(256);
CREATE INDEX sp_idx_target_group ON sp_target (tenant, target_group);

View File

@@ -1,4 +0,0 @@
ALTER TABLE sp_software_module_type ADD COLUMN min_artifacts integer default 0 NOT NULL;
ALTER TABLE sp_distribution_set DROP INDEX sp_idx_distribution_set_01;
CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set (tenant, deleted);
ALTER TABLE sp_distribution_set DROP COLUMN complete;

View File

@@ -1,4 +0,0 @@
DELETE FROM sp_tenant_configuration WHERE conf_key='action.cleanup.enabled';
UPDATE sp_tenant_configuration SET conf_key='action.cleanup.auto.expiry' WHERE conf_key='action.cleanup.actionExpiry';
UPDATE sp_tenant_configuration SET conf_key='action.cleanup.auto.status' WHERE conf_key='action.cleanup.actionStatus';
UPDATE sp_tenant_configuration SET conf_key='actions.cleanup.onQuotaHit.percent' WHERE conf_key='action.cleanup.onQuotaHit.percent';

View File

@@ -1,198 +0,0 @@
UPDATE sp_software_module SET name = '' WHERE name IS NULL;
UPDATE sp_software_module_type SET name = '' WHERE name IS NULL;
UPDATE sp_distribution_set SET name = '' WHERE name IS NULL;
UPDATE sp_distribution_set_type SET name = '' WHERE name IS NULL;
UPDATE sp_distribution_set_tag SET name = '' WHERE name IS NULL;
UPDATE sp_target SET name = '' WHERE name IS NULL;
UPDATE sp_target_type SET name = '' WHERE name IS NULL;
UPDATE sp_target_tag SET name = '' WHERE name IS NULL;
UPDATE sp_target_filter_query SET name = '' WHERE name IS NULL;
UPDATE sp_rollout SET name = '' WHERE name IS NULL;
UPDATE sp_rollout_group SET name = '' WHERE name IS NULL;
UPDATE sp_target SET controller_id = '' WHERE controller_id IS NULL;
ALTER TABLE sp_action
MODIFY active TINYINT(1);
ALTER TABLE sp_distribution_set
MODIFY name VARCHAR(128) NOT NULL,
MODIFY deleted TINYINT(1),
MODIFY required_migration_step TINYINT(1);
ALTER TABLE sp_distribution_set_type
MODIFY name VARCHAR(128) NOT NULL,
MODIFY deleted TINYINT(1);
ALTER TABLE sp_distribution_set_tag
MODIFY name VARCHAR(128) NOT NULL;
ALTER TABLE sp_ds_type_element
MODIFY mandatory TINYINT(1);
ALTER TABLE sp_sm_metadata
MODIFY target_visible TINYINT(1);
ALTER TABLE sp_software_module
MODIFY name VARCHAR(128) NOT NULL,
MODIFY deleted TINYINT(1);
ALTER TABLE sp_software_module_type
MODIFY name VARCHAR(128) NOT NULL,
MODIFY deleted TINYINT(1);
ALTER TABLE sp_target
MODIFY name VARCHAR(128) NOT NULL,
MODIFY controller_id VARCHAR(256) NOT NULL,
MODIFY request_controller_attributes TINYINT(1) NOT NULL;
ALTER TABLE sp_target_type
MODIFY name VARCHAR(128) NOT NULL,
ALTER COLUMN type_key DROP DEFAULT;
ALTER TABLE sp_target_tag
MODIFY name VARCHAR(128) NOT NULL;
ALTER TABLE sp_target_filter_query
MODIFY name VARCHAR(128) NOT NULL;
ALTER TABLE sp_rollout
MODIFY name VARCHAR(128) NOT NULL,
DROP COLUMN group_theshold;
ALTER TABLE sp_rollout_group
MODIFY name VARCHAR(128) NOT NULL,
DROP INDEX sp_idx_rollout_group_parent;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE sp_action
DROP FOREIGN KEY fk_action_ds,
ADD CONSTRAINT fk_action_distribution_set
FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id),
DROP FOREIGN KEY fk_action_rolloutgroup,
ADD CONSTRAINT fk_action_rollout_group
FOREIGN KEY (rollout_group) REFERENCES sp_rollout_group (id),
DROP FOREIGN KEY fk_targ_act_hist_targ,
ADD CONSTRAINT fk_action_target
FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE;
ALTER TABLE sp_action_status
DROP FOREIGN KEY fk_act_stat_action,
ADD CONSTRAINT fk_action_status_action
FOREIGN KEY (action) REFERENCES sp_action (id) ON DELETE CASCADE;
ALTER TABLE sp_action_status_messages
DROP FOREIGN KEY fk_stat_msg_act_stat,
ADD CONSTRAINT fk_action_status_messages_action_status
FOREIGN KEY (action_status) REFERENCES sp_action_status (id) ON DELETE CASCADE;
ALTER TABLE sp_artifact
DROP FOREIGN KEY fk_assigned_sm,
ADD CONSTRAINT fk_artifact_software_module
FOREIGN KEY (software_module) REFERENCES sp_software_module (id) ON DELETE CASCADE;
ALTER TABLE sp_distribution_set
DROP FOREIGN KEY fk_ds_dstype_ds,
ADD CONSTRAINT fk_distribution_set_ds_type
FOREIGN KEY (ds_type) REFERENCES sp_distribution_set_type (id);
ALTER TABLE sp_ds_metadata
DROP FOREIGN KEY fk_metadata_ds,
ADD CONSTRAINT fk_ds_metadata_ds
FOREIGN KEY (ds) REFERENCES sp_distribution_set (id) ON DELETE CASCADE;
ALTER TABLE sp_ds_sm
DROP FOREIGN KEY fk_ds_module_ds,
ADD CONSTRAINT fk_ds_sm_ds_id
FOREIGN KEY (ds_id) REFERENCES sp_distribution_set (id) ON DELETE CASCADE,
DROP FOREIGN KEY fk_ds_module_module,
ADD CONSTRAINT fk_ds_sm_sm_id
FOREIGN KEY (sm_id) REFERENCES sp_software_module (id) ON DELETE CASCADE;
ALTER TABLE sp_ds_tag
DROP FOREIGN KEY fk_ds_dstag_ds,
ADD CONSTRAINT fk_ds_tag_ds
FOREIGN KEY (ds) REFERENCES sp_distribution_set (id) ON DELETE CASCADE,
DROP FOREIGN KEY fk_ds_dstag_tag,
ADD CONSTRAINT fk_ds_tag_tag
FOREIGN KEY (tag) REFERENCES sp_distribution_set_tag (id) ON DELETE CASCADE;
ALTER TABLE sp_ds_type_element
DROP FOREIGN KEY fk_ds_type_element_element,
ADD CONSTRAINT fk_ds_type_element_distribution_set_type
FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE,
DROP FOREIGN KEY fk_ds_type_element_smtype,
ADD CONSTRAINT fk_ds_type_element_software_module_type
FOREIGN KEY (software_module_type) REFERENCES sp_software_module_type (id) ON DELETE CASCADE;
ALTER TABLE sp_rollout
DROP FOREIGN KEY fk_rollout_ds,
ADD CONSTRAINT fk_rollout_distribution_set
FOREIGN KEY (distribution_set) REFERENCES sp_distribution_set (id);
ALTER TABLE sp_rollout_group
DROP FOREIGN KEY fk_rolloutgroup_rollout,
ADD CONSTRAINT fk_rollout_group_rollout
FOREIGN KEY (rollout) REFERENCES sp_rollout (id) ON DELETE CASCADE;
ALTER TABLE sp_rollout_target_group
DROP FOREIGN KEY fk_rollouttargetgroup_rolloutgroup,
ADD CONSTRAINT fk_rollout_target_group_rollout_group
FOREIGN KEY (rollout_group) REFERENCES sp_rollout_group (id) ON DELETE CASCADE,
DROP FOREIGN KEY fk_rollouttargetgroup_target,
ADD CONSTRAINT fk_rollout_target_group_target
FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE;
ALTER TABLE sp_sm_metadata
DROP FOREIGN KEY fk_metadata_sw,
ADD CONSTRAINT fk_sm_metadata_sm
FOREIGN KEY (sm) REFERENCES sp_software_module (id) ON DELETE CASCADE;
ALTER TABLE sp_software_module
DROP FOREIGN KEY fk_module_type,
ADD CONSTRAINT fk_software_module_sm_type
FOREIGN KEY (sm_type) REFERENCES sp_software_module_type (id);
ALTER TABLE sp_target_attributes
DROP FOREIGN KEY fk_targ_attrib_target,
ADD CONSTRAINT fk_target_attributes_target
FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE;
ALTER TABLE sp_target_conf_status
DROP FOREIGN KEY fk_target_auto_conf,
ADD CONSTRAINT fk_target_conf_status_target
FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE;
ALTER TABLE sp_target_filter_query
DROP FOREIGN KEY fk_filter_auto_assign_ds,
ADD CONSTRAINT fk_target_filter_query_auto_assign_distribution_set
FOREIGN KEY (auto_assign_distribution_set) REFERENCES sp_distribution_set (id) ON DELETE SET NULL;
ALTER TABLE sp_target_metadata
DROP FOREIGN KEY fk_metadata_target,
ADD CONSTRAINT fk_target_metadata_target
FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE;
ALTER TABLE sp_target_target_tag
DROP FOREIGN KEY fk_targ_targtag_tag,
ADD CONSTRAINT fk_target_target_tag_tag
FOREIGN KEY (tag) REFERENCES sp_target_tag (id) ON DELETE CASCADE,
DROP FOREIGN KEY fk_targ_targtag_target,
ADD CONSTRAINT fk_target_target_tag_target
FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE;
ALTER TABLE sp_target_type_ds_type
DROP FOREIGN KEY fk_target_type_relation_ds_type,
ADD CONSTRAINT fk_target_type_ds_type_distribution_set_type
FOREIGN KEY (distribution_set_type) REFERENCES sp_distribution_set_type (id) ON DELETE CASCADE,
DROP FOREIGN KEY fk_target_type_relation_target_type,
ADD CONSTRAINT fk_target_type_ds_type_target_type
FOREIGN KEY (target_type) REFERENCES sp_target_type (id) ON DELETE CASCADE;
ALTER TABLE sp_tenant
DROP FOREIGN KEY fk_tenant_md_default_ds_type,
ADD CONSTRAINT fk_tenant_default_ds_type
FOREIGN KEY (default_ds_type) REFERENCES sp_distribution_set_type (id);
SET FOREIGN_KEY_CHECKS=1;

View File

@@ -1,3 +0,0 @@
ALTER TABLE sp_tenant_configuration MODIFY conf_value TEXT NOT NULL;
ALTER TABLE sp_target_filter_query MODIFY access_control_context TEXT;
ALTER TABLE sp_rollout MODIFY access_control_context TEXT;

View File

@@ -1 +0,0 @@
CREATE INDEX sp_idx_rollout_group_parent ON sp_rollout_group (parent);

View File

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

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