add excel templates fix apis
This commit is contained in:
43
src/main/resources/dbmigration/1.3.sql
Normal file
43
src/main/resources/dbmigration/1.3.sql
Normal file
@@ -0,0 +1,43 @@
|
||||
-- drop dependencies
|
||||
alter table document drop constraint if exists ck_document_type_of_doc;
|
||||
alter table product drop constraint if exists ck_product_uom;
|
||||
-- apply changes
|
||||
create table req_for_quote (
|
||||
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,
|
||||
potential_vendors bigint[],
|
||||
open_till date,
|
||||
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,
|
||||
status varchar(9),
|
||||
products jsonb,
|
||||
req_for_quote_num varchar(255),
|
||||
created_by varchar(255) not null,
|
||||
modified_by varchar(255) not null,
|
||||
constraint ck_req_for_quote_approval_status check ( approval_status in ('PENDING','APPROVED','REJECTED')),
|
||||
constraint ck_req_for_quote_status check ( status in ('DELIVERED','PO','QUOTE','CANCELLED')),
|
||||
constraint pk_req_for_quote primary key (sys_pk)
|
||||
);
|
||||
|
||||
-- apply alter tables
|
||||
alter table document alter column type_of_doc type varchar(7) using type_of_doc::varchar(7);
|
||||
alter table document alter column type_of_doc drop not null;
|
||||
alter table document add column if not exists ref_id varchar(255);
|
||||
alter table document add column if not exists doc_date date;
|
||||
alter table product add column if not exists id bigint;
|
||||
alter table purchase_order alter column reference_quotation drop not null;
|
||||
alter table purchase_order alter column total_amount type float using total_amount::float;
|
||||
alter table quotation alter column total_amount type float using total_amount::float;
|
||||
alter table quotation add column if not exists req_for_quote_num varchar(255);
|
||||
-- apply post alter
|
||||
alter table document add constraint ck_document_type_of_doc check ( type_of_doc in ('PO','QUOTE','INVOICE','ALL'));
|
||||
alter table product add constraint ck_product_uom check ( uom in ('NOS','LTR','MTR','ALL'));
|
||||
42
src/main/resources/dbmigration/model/1.3.model.xml
Normal file
42
src/main/resources/dbmigration/model/1.3.model.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
|
||||
<changeSet type="apply">
|
||||
<alterColumn columnName="type_of_doc" tableName="document" type="varchar(7)" currentType="varchar" notnull="false" currentNotnull="true" checkConstraint="check ( type_of_doc in ('PO','QUOTE','INVOICE','ALL'))" checkConstraintName="ck_document_type_of_doc"/>
|
||||
<addColumn tableName="document">
|
||||
<column name="ref_id" type="varchar"/>
|
||||
<column name="doc_date" type="date"/>
|
||||
</addColumn>
|
||||
<alterColumn columnName="uom" tableName="product" checkConstraint="check ( uom in ('NOS','LTR','MTR','ALL'))" checkConstraintName="ck_product_uom"/>
|
||||
<addColumn tableName="product">
|
||||
<column name="id" type="bigint"/>
|
||||
</addColumn>
|
||||
<alterColumn columnName="reference_quotation" tableName="purchase_order" currentType="varchar" notnull="false" currentNotnull="true"/>
|
||||
<alterColumn columnName="total_amount" tableName="purchase_order" type="double" currentType="integer" currentNotnull="true"/>
|
||||
<alterColumn columnName="total_amount" tableName="quotation" type="double" currentType="integer" currentNotnull="true"/>
|
||||
<addColumn tableName="quotation">
|
||||
<column name="req_for_quote_num" type="varchar"/>
|
||||
</addColumn>
|
||||
<createTable name="req_for_quote" pkName="pk_req_for_quote">
|
||||
<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_req_for_quote_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="potential_vendors" type="bigint[]"/>
|
||||
<column name="status" type="varchar(9)" checkConstraint="check ( status in ('DELIVERED','PO','QUOTE','CANCELLED'))" checkConstraintName="ck_req_for_quote_status"/>
|
||||
<column name="products" type="jsonb"/>
|
||||
<column name="req_for_quote_num" type="varchar"/>
|
||||
<column name="open_till" type="date"/>
|
||||
<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"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
</migration>
|
||||
Reference in New Issue
Block a user