simple api model

This commit is contained in:
gowthaman.b 2023-11-10 11:07:18 +05:30
parent 01e197b0f8
commit b0042d2e6b
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,23 @@
-- apply changes
create table data_model (
sys_pk bigint generated by default as identity not null,
deleted_on timestamp,
deleted boolean default false not null,
version integer not null,
created_at timestamp not null,
modified_at timestamp not null,
tenant_id varchar(255) not null,
deleted_by varchar(255),
tags varchar[] not null,
comments jsonb not null,
unique_identifier varchar(255) not null,
entity_name varchar(255) not null,
data jsonb not null,
created_by varchar(255) not null,
modified_by varchar(255) not null,
constraint entity_unique_id unique (entity_name,unique_identifier,tenant_id),
constraint pk_data_model primary key (sys_pk)
);
-- foreign keys and indices
create index data_jsonb_idx on data_model using GIN (data) ;

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
<changeSet type="apply">
<createTable name="data_model" pkName="pk_data_model">
<column name="sys_pk" type="bigint" primaryKey="true"/>
<column name="tenant_id" type="varchar" notnull="true"/>
<column name="deleted_on" type="localdatetime"/>
<column name="deleted_by" type="varchar"/>
<column name="tags" type="varchar[]" notnull="true"/>
<column name="comments" type="jsonb" notnull="true"/>
<column name="unique_identifier" type="varchar" notnull="true"/>
<column name="entity_name" type="varchar" notnull="true"/>
<column name="data" type="jsonb" notnull="true"/>
<column name="deleted" type="boolean" defaultValue="false" notnull="true"/>
<column name="version" type="integer" notnull="true"/>
<column name="created_at" type="localdatetime" notnull="true"/>
<column name="modified_at" type="localdatetime" notnull="true"/>
<column name="created_by" type="varchar" notnull="true"/>
<column name="modified_by" type="varchar" notnull="true"/>
<uniqueConstraint name="entity_unique_id" columnNames="entity_name,unique_identifier,tenant_id" oneToOne="false" nullableColumns=""/>
</createTable>
<createIndex indexName="ix_data_model_data" tableName="data_model" columns="data" definition="create index data_jsonb_idx on data_model using GIN (data) " platforms="POSTGRES"/>
</changeSet>
</migration>