liquibase changelogs distributed to adapter modules

This commit is contained in:
Adam Kulawik
2018-06-05 22:53:18 +02:00
parent 08554b0cca
commit af639c661a
15 changed files with 329 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<include file="/schema/commons.xml"/>
<include file="/schema/delivery-planning.xml"/>
<include file="/schema/demand-forecasting.xml"/>
</databaseChangeLog>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<property name="json" value="clob" dbms="h2"/>
<property name="json" value="jsonb" dbms="postgresql"/>
<changeSet author="jakubpilimon" id="1.delivery-planning-init">
<sql>
CREATE SCHEMA delivery_planning
</sql>
<createTable tableName="delivery_planner_definition" schemaName="delivery_planning">
<column name="ref_no" type="varchar(64)">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="definition" type="${json}">
<constraints nullable="false"/>
</column>
</createTable>
<createTable tableName="delivery_forecast" schemaName="delivery_planning">
<column name="id" type="serial">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="ref_no" type="varchar(64)">
<constraints nullable="false"/>
</column>
<column name="time" type="timestamp">
<constraints nullable="false"/>
</column>
<column name="date" type="timestamp">
<constraints nullable="false"/>
</column>
<column name="level" type="bigint">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<property name="json" value="clob" dbms="h2"/>
<property name="json" value="jsonb" dbms="postgresql"/>
<changeSet author="jakubpilimon" id="1.demand_forecasting-init">
<sql>
CREATE SCHEMA demand_forecasting
</sql>
<createTable tableName="product_demand" schemaName="demand_forecasting">
<column name="id" type="serial">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="version" type="bigint">
<constraints nullable="false"/>
</column>
<column name="ref_no" type="varchar(64)">
<constraints unique="true"/>
</column>
</createTable>
<createTable tableName="demand" schemaName="demand_forecasting">
<column name="id" type="serial">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="ref_no" type="varchar(64)">
<constraints nullable="false"/>
</column>
<column name="date" type="timestamp">
<constraints nullable="false"/>
</column>
<column name="value" type="${json}">
<constraints nullable="false"/>
</column>
</createTable>
<addUniqueConstraint
columnNames="ref_no, date"
constraintName="demand_refno_date_unique"
schemaName="demand_forecasting"
tableName="demand"/>
<createTable tableName="current_demand" schemaName="demand_forecasting">
<column name="id" type="serial">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="ref_no" type="varchar(64)">
<constraints nullable="false"/>
</column>
<column name="date" type="timestamp">
<constraints nullable="false"/>
</column>
<column name="level" type="bigint">
<constraints nullable="false"/>
</column>
<column name="schema" type="varchar(64)">
<constraints nullable="false"/>
</column>
</createTable>
<addUniqueConstraint
columnNames="ref_no, date"
constraintName="cr_demand_refno_date_unique"
schemaName="demand_forecasting"
tableName="current_demand"/>
<createTable tableName="demand_adjustment" schemaName="demand_forecasting">
<column name="id" type="serial">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="customer_representative" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="note" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="adjustment" type="${json}">
<constraints nullable="false"/>
</column>
<column name="clean_after" type="timestamp"/>
</createTable>
<createTable tableName="demand_review" schemaName="demand_forecasting">
<column name="id" type="serial">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="ref_no" type="varchar(64)">
<constraints nullable="false"/>
</column>
<column name="date" type="timestamp">
<constraints nullable="false"/>
</column>
<column name="timestamp" type="timestamp">
<constraints nullable="false"/>
</column>
<column name="review" type="${json}">
<constraints nullable="false"/>
</column>
<column name="decision" type="varchar(64)"/>
<column name="clean_after" type="timestamp"/>
</createTable>
</changeSet>
<changeSet author="jakubpilimon" id="2.rename.review.table">
<renameTable oldTableName="demand_review" newTableName="required_review" schemaName="demand_forecasting"/>
</changeSet>
<changeSet author="jakubpilimon" id="3.create.document.table">
<createTable tableName="document" schemaName="demand_forecasting">
<column name="id" type="serial">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="ref_no" type="varchar(64)">
<constraints nullable="false"/>
</column>
<column name="original_uri" type="varchar(1024)">
<constraints nullable="false"/>
</column>
<column name="stored_uri" type="varchar(1024)">
<constraints nullable="false"/>
</column>
<column name="saved" type="timestamp">
<constraints nullable="false"/>
</column>
<column name="document" type="${json}">
<constraints nullable="false"/>
</column>
<column name="clean_after" type="timestamp"/>
</createTable>
</changeSet>
</databaseChangeLog>