remove older migrations

This commit is contained in:
gowthaman.b 2024-01-05 09:19:21 +05:30
parent 5e7e4c820c
commit 82fb57bd85
15 changed files with 63 additions and 109 deletions

2
.idea/kotlinc.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.20" />
<option name="version" value="1.9.22" />
</component>
</project>

1
.idea/vcs.xml generated
View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../rmc-modules-app" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,4 +0,0 @@
insert into tenant_model(name, domain, created_by, modified_by)
values ('compegence', 'https://www.compegence.com', 'system', 'system');
insert into entity_model(name, tenant_id, created_by, modified_by, pre_save_script, post_save_script)
values ('vehicle', 'compegence', 'system', 'system', 'vehicle.kts', 'vehicle.kts');

View File

@ -1,4 +0,0 @@
insert into sql_model(tenant_id, entity_name, sql_id, sql, created_by, modified_by)
values ('compegence', 'vehicle', 'SQL0001',
'select sys_pk,deleted_on,current_approval_level,required_approval_levels,deleted,version,created_at,modified_at,deleted_by,approval_status,tags,comments,tenant_id,unique_identifier,entity_name,data,created_by,modified_by from entity_model where created_at >= ?',
'system', 'system')

View File

@ -1,5 +0,0 @@
delete from sql_model where tenant_id = 'compegence' and sql_id = 'SQL0001';
insert into sql_model(tenant_id, entity_name, sql_id, sql, created_by, modified_by)
values ('compegence', 'vehicle', 'SQL0001',
'select sys_pk,deleted_on,current_approval_level,required_approval_levels,deleted,version,created_at,modified_at,deleted_by,approval_status,tags,comments,tenant_id,unique_identifier,entity_name,data,created_by,modified_by from entity_model where created_at >= ?',
'system', 'system')

View File

@ -1,2 +0,0 @@
insert into entity_model(name, tenant_id, created_by, modified_by, pre_save_script, post_save_script)
values ('log', 'compegence', 'system', 'system', '', '');

View File

@ -1,5 +0,0 @@
delete from sql_model where tenant_id = 'compegence' and sql_id = 'SQL0001';
insert into sql_model(tenant_id, entity_name, sql_id, sql, created_by, modified_by)
values ('compegence', 'vehicle', 'SQL0001',
'select sys_pk,deleted_on,current_approval_level,required_approval_levels,deleted,version,created_at,modified_at,deleted_by,approval_status,tags,comments,tenant_id,entity_name,data,created_by,modified_by from entity_model where created_at >= ?',
'system', 'system')

View File

@ -1,5 +0,0 @@
delete from sql_model where tenant_id = 'compegence' and sql_id = 'SQL0001';
insert into sql_model(tenant_id, entity_name, sql_id, sql, created_by, modified_by)
values ('compegence', 'vehicle', 'SQL0001',
'select sys_pk,deleted_on,current_approval_level,required_approval_levels,deleted,version,created_at,modified_at,deleted_by,approval_status,tags,comments,tenant_id,data,created_by,modified_by from entity_model where created_at >= ?',
'system', 'system')

View File

@ -1,5 +0,0 @@
delete from sql_model where tenant_id = 'compegence' and sql_id = 'SQL0001';
insert into sql_model(tenant_id, entity_name, sql_id, sql, created_by, modified_by)
values ('compegence', 'vehicle', 'SQL0001',
'select sys_pk,deleted_on,current_approval_level,required_approval_levels,deleted,version,created_at,modified_at,deleted_by,approval_status,tags,comments,tenant_id,data,created_by,modified_by from entity_model where created_at >= ?',
'system', 'system')

View File

@ -1,5 +0,0 @@
delete from sql_model where tenant_id = 'compegence' and sql_id = 'SQL0001';
insert into sql_model(tenant_id, entity_name, sql_id, sql, created_by, modified_by)
values ('compegence', 'vehicle', 'SQL0001',
'select sys_pk,deleted_on,current_approval_level,required_approval_levels,deleted,version,created_at,modified_at,deleted_by,approval_status,tags,comments,tenant_id,created_by,modified_by from entity_model where created_at >= ?',
'system', 'system')

View File

@ -1 +0,0 @@
update entity_model set required_approval_levels = 1 WHERE entity_model.name = 'vehicle'

View File

@ -1,27 +0,0 @@
-- apply changes
create table sql_model (
sys_pk bigint generated by default as identity not null,
deleted_on timestamp,
current_approval_level integer default 0 not null,
required_approval_levels integer default 0 not null,
sql text not null,
deleted boolean default false not null,
version integer default 1 not null,
created_at timestamp default 'now()' not null,
modified_at timestamp default 'now()' not null,
deleted_by varchar(255),
approval_status varchar(8) default 'APPROVED' not null,
tags varchar[] default '{}' not null,
comments jsonb default '[]' not null,
tenant_id varchar(255) not null,
sql_id varchar(255) not null,
entity_name varchar(255) not null,
created_by varchar(255) not null,
modified_by varchar(255) not null,
constraint ck_sql_model_approval_status check ( approval_status in ('PENDING','APPROVED','REJECTED')),
constraint sql_unique_id unique (entity_name,sql_id,tenant_id),
constraint pk_sql_model primary key (sys_pk)
);
ALTER TABLE sql_model ADD FOREIGN KEY(tenant_id) REFERENCES tenant_model(name);
ALTER TABLE sql_model ADD FOREIGN KEY(entity_name) REFERENCES entity_model(name);

View File

@ -10,8 +10,8 @@ create table audit_log (
modified_at timestamp default 'now()' not null,
deleted_by varchar(255),
approval_status varchar(8) default 'APPROVED' not null,
tags text[] default '{}'::text[] not null,
comments jsonb default '[]'::jsonb not null,
tags varchar[] default '{}' not null,
comments jsonb default '[]' not null,
tenant_id varchar(255) not null,
audit_type varchar(7) not null,
entity varchar(255) not null,
@ -36,8 +36,8 @@ create table data_model (
modified_at timestamp default 'now()' not null,
deleted_by varchar(255),
approval_status varchar(8) default 'APPROVED' not null,
tags text[] default '{}'::text[] not null,
comments jsonb default '[]'::jsonb not null,
tags varchar[] default '{}' not null,
comments jsonb default '[]' not null,
tenant_id varchar(255) not null,
unique_identifier varchar(255) not null,
entity_name varchar(255) not null,
@ -61,17 +61,17 @@ create table entity_model (
modified_at timestamp default 'now()' not null,
deleted_by varchar(255),
approval_status varchar(8) default 'APPROVED' not null,
tags text[] default '{}'::text[] not null,
comments jsonb default '[]'::jsonb not null,
tags varchar[] default '{}' not null,
comments jsonb default '[]' not null,
tenant_id varchar(255) not null,
name varchar(255) not null,
pre_save_script varchar(255),
post_save_script varchar(255),
actions text[] default '{}'::text[] not null,
allowed_fields text[] default '{}'::text[] not null,
allowed_field_types jsonb default '{}'::jsonb not null,
audit_log_fields text[] default '{}'::text[] not null,
preferences jsonb default '{}'::jsonb not null,
actions varchar[] default '{}' not null,
allowed_fields varchar[] default '{}' not null,
allowed_field_types jsonb default '{}' not null,
audit_log_fields varchar[] default '{}' not null,
preferences jsonb default '{}' not null,
created_by varchar(255) not null,
modified_by varchar(255) not null,
constraint ck_entity_model_approval_status check ( approval_status in ('PENDING','APPROVED','REJECTED')),
@ -90,8 +90,8 @@ create table job_model (
modified_at timestamp default 'now()' not null,
deleted_by varchar(255),
approval_status varchar(8) default 'APPROVED' not null,
tags text[] default '{}'::text[] not null,
comments jsonb default '[]'::jsonb not null,
tags varchar[] default '{}' not null,
comments jsonb default '[]' not null,
tenant_id varchar(255) not null,
job_name varchar(255) not null,
job_type varchar(6) not null,
@ -108,6 +108,30 @@ create table job_model (
constraint pk_job_model primary key (sys_pk)
);
create table sql_model (
sys_pk bigint generated by default as identity not null,
deleted_on timestamp,
current_approval_level integer default 0 not null,
required_approval_levels integer default 0 not null,
sql text not null,
deleted boolean default false not null,
version integer default 1 not null,
created_at timestamp default 'now()' not null,
modified_at timestamp default 'now()' not null,
deleted_by varchar(255),
approval_status varchar(8) default 'APPROVED' not null,
tags varchar[] default '{}' not null,
comments jsonb default '[]' not null,
tenant_id varchar(255) not null,
sql_id varchar(255) not null,
entity_name varchar(255) not null,
created_by varchar(255) not null,
modified_by varchar(255) not null,
constraint ck_sql_model_approval_status check ( approval_status in ('PENDING','APPROVED','REJECTED')),
constraint sql_unique_id unique (entity_name,sql_id,tenant_id),
constraint pk_sql_model primary key (sys_pk)
);
create table tenant_model (
sys_pk bigint generated by default as identity not null,
deleted_on timestamp,
@ -119,11 +143,11 @@ create table tenant_model (
modified_at timestamp default 'now()' not null,
deleted_by varchar(255),
approval_status varchar(8) default 'APPROVED' not null,
tags text[] default '{}'::text[] not null,
comments jsonb default '[]'::jsonb not null,
tags varchar[] default '{}' not null,
comments jsonb default '[]' not null,
name varchar(255) not null,
domain varchar(255) not null,
preferences jsonb default '{}'::jsonb not null,
preferences jsonb not null,
created_by varchar(255) not null,
modified_by varchar(255) not null,
constraint ck_tenant_model_approval_status check ( approval_status in ('PENDING','APPROVED','REJECTED')),
@ -136,6 +160,3 @@ create index if not exists ix_audit_log_audit_type_entity_unique_identifier_tena
create index audit_log_values_idx on audit_log using GIN (data);
create index audit_log_changes_idx on audit_log using GIN (changes);
create index data_jsonb_idx on data_model using GIN (data) ;
ALTER TABLE data_model ADD FOREIGN KEY(tenant_id) REFERENCES tenant_model(name);
ALTER TABLE data_model ADD FOREIGN KEY(entity_name) REFERENCES entity_model(name);

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
<changeSet type="apply">
<createTable name="sql_model" pkName="pk_sql_model">
<column name="sys_pk" type="bigint" primaryKey="true"/>
<column name="deleted_on" type="localdatetime"/>
<column name="deleted_by" type="varchar"/>
<column name="current_approval_level" type="integer" defaultValue="0" notnull="true"/>
<column name="required_approval_levels" type="integer" defaultValue="0" notnull="true"/>
<column name="approval_status" type="varchar(8)" defaultValue="'APPROVED'" notnull="true" checkConstraint="check ( approval_status in ('PENDING','APPROVED','REJECTED'))" checkConstraintName="ck_sql_model_approval_status"/>
<column name="tags" type="varchar[]" defaultValue="'{}'" notnull="true"/>
<column name="comments" type="jsonb" defaultValue="'[]'" notnull="true"/>
<column name="tenant_id" type="varchar" notnull="true"/>
<column name="sql_id" type="varchar" notnull="true"/>
<column name="entity_name" type="varchar" notnull="true"/>
<column name="sql" type="text" notnull="true"/>
<column name="deleted" type="boolean" defaultValue="false" notnull="true"/>
<column name="version" type="integer" defaultValue="1" notnull="true"/>
<column name="created_at" type="localdatetime" defaultValue="'now()'" notnull="true"/>
<column name="modified_at" type="localdatetime" defaultValue="'now()'" notnull="true"/>
<column name="created_by" type="varchar" notnull="true"/>
<column name="modified_by" type="varchar" notnull="true"/>
<uniqueConstraint name="sql_unique_id" columnNames="entity_name,sql_id,tenant_id" oneToOne="false" nullableColumns=""/>
</createTable>
</changeSet>
</migration>

View File

@ -95,6 +95,27 @@
<column name="modified_by" type="varchar" notnull="true"/>
<uniqueConstraint name="uq_job_model_job_name" columnNames="job_name" oneToOne="false" nullableColumns=""/>
</createTable>
<createTable name="sql_model" pkName="pk_sql_model">
<column name="sys_pk" type="bigint" primaryKey="true"/>
<column name="deleted_on" type="localdatetime"/>
<column name="deleted_by" type="varchar"/>
<column name="current_approval_level" type="integer" defaultValue="0" notnull="true"/>
<column name="required_approval_levels" type="integer" defaultValue="0" notnull="true"/>
<column name="approval_status" type="varchar(8)" defaultValue="'APPROVED'" notnull="true" checkConstraint="check ( approval_status in ('PENDING','APPROVED','REJECTED'))" checkConstraintName="ck_sql_model_approval_status"/>
<column name="tags" type="varchar[]" defaultValue="'{}'" notnull="true"/>
<column name="comments" type="jsonb" defaultValue="'[]'" notnull="true"/>
<column name="tenant_id" type="varchar" notnull="true"/>
<column name="sql_id" type="varchar" notnull="true"/>
<column name="entity_name" type="varchar" notnull="true"/>
<column name="sql" type="text" notnull="true"/>
<column name="deleted" type="boolean" defaultValue="false" notnull="true"/>
<column name="version" type="integer" defaultValue="1" notnull="true"/>
<column name="created_at" type="localdatetime" defaultValue="'now()'" notnull="true"/>
<column name="modified_at" type="localdatetime" defaultValue="'now()'" notnull="true"/>
<column name="created_by" type="varchar" notnull="true"/>
<column name="modified_by" type="varchar" notnull="true"/>
<uniqueConstraint name="sql_unique_id" columnNames="entity_name,sql_id,tenant_id" oneToOne="false" nullableColumns=""/>
</createTable>
<createTable name="tenant_model" pkName="pk_tenant_model">
<column name="sys_pk" type="bigint" primaryKey="true"/>
<column name="deleted_on" type="localdatetime"/>