From 41bafb2387f9794b8f65d4eac53cbc698a7525f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Michaluk?= Date: Mon, 25 Jun 2018 02:11:40 +0200 Subject: [PATCH] liquidbase changelogs converted to yaml --- .../src/main/resources/schema/commons.xml | 11 - .../src/main/resources/schema/commons.yml | 21 ++ .../src/test/resources/application.properties | 3 +- app-monolith/Dockerfile | 4 +- app-monolith/pom.xml | 10 + .../src/main/resources/application.properties | 2 +- .../main/resources/schema/db.changelog.xml | 11 - .../main/resources/schema/db.changelog.yml | 13 + .../resources/schema/delivery-planning.xml | 42 --- .../resources/schema/demand-forecasting.xml | 134 ---------- .../resources/schema/product-management.xml | 24 -- .../resources/schema/production-planning.xml | 60 ----- .../resources/schema/shortages-prediction.xml | 40 --- .../main/resources/schema/db.changelog.yml | 7 + .../resources/schema/delivery-planning.xml | 42 --- .../resources/schema/delivery-planning.yml | 72 ++++++ .../resources/schema/demand-forecasting.xml | 134 ---------- .../resources/schema/demand-forecasting.yml | 242 ++++++++++++++++++ .../main/resources/schema/db.changelog.yml | 5 + .../resources/schema/product-management.xml | 24 -- .../resources/schema/product-management.yml | 40 +++ .../main/resources/schema/db.changelog.yml | 5 + .../resources/schema/production-planning.xml | 60 ----- .../resources/schema/production-planning.yml | 98 +++++++ .../main/resources/schema/db.changelog.yml | 5 + .../resources/schema/shortages-prediction.xml | 40 --- .../resources/schema/shortages-prediction.yml | 78 ++++++ 27 files changed, 600 insertions(+), 627 deletions(-) delete mode 100644 adapter-commons/src/main/resources/schema/commons.xml create mode 100644 adapter-commons/src/main/resources/schema/commons.yml delete mode 100644 app-monolith/src/main/resources/schema/db.changelog.xml create mode 100644 app-monolith/src/main/resources/schema/db.changelog.yml delete mode 100644 app-monolith/src/main/resources/schema/delivery-planning.xml delete mode 100644 app-monolith/src/main/resources/schema/demand-forecasting.xml delete mode 100644 app-monolith/src/main/resources/schema/product-management.xml delete mode 100644 app-monolith/src/main/resources/schema/production-planning.xml delete mode 100644 app-monolith/src/main/resources/schema/shortages-prediction.xml create mode 100644 demand-forecasting-adapters/src/main/resources/schema/db.changelog.yml delete mode 100644 demand-forecasting-adapters/src/main/resources/schema/delivery-planning.xml create mode 100644 demand-forecasting-adapters/src/main/resources/schema/delivery-planning.yml delete mode 100644 demand-forecasting-adapters/src/main/resources/schema/demand-forecasting.xml create mode 100644 demand-forecasting-adapters/src/main/resources/schema/demand-forecasting.yml create mode 100644 product-management-adapters/src/main/resources/schema/db.changelog.yml delete mode 100644 product-management-adapters/src/main/resources/schema/product-management.xml create mode 100644 product-management-adapters/src/main/resources/schema/product-management.yml create mode 100644 production-planning-adapters/src/main/resources/schema/db.changelog.yml delete mode 100644 production-planning-adapters/src/main/resources/schema/production-planning.xml create mode 100644 production-planning-adapters/src/main/resources/schema/production-planning.yml create mode 100644 shortages-prediction-adapters/src/main/resources/schema/db.changelog.yml delete mode 100644 shortages-prediction-adapters/src/main/resources/schema/shortages-prediction.xml create mode 100644 shortages-prediction-adapters/src/main/resources/schema/shortages-prediction.yml diff --git a/adapter-commons/src/main/resources/schema/commons.xml b/adapter-commons/src/main/resources/schema/commons.xml deleted file mode 100644 index 4387e16..0000000 --- a/adapter-commons/src/main/resources/schema/commons.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - CREATE CAST (VARCHAR AS jsonb) WITH INOUT AS ASSIGNMENT - - diff --git a/adapter-commons/src/main/resources/schema/commons.yml b/adapter-commons/src/main/resources/schema/commons.yml new file mode 100644 index 0000000..b6a31c2 --- /dev/null +++ b/adapter-commons/src/main/resources/schema/commons.yml @@ -0,0 +1,21 @@ +databaseChangeLog: + +- changeSet: + id: 1.hibernate.init + author: Michal Michaluk + changes: + - createSequence: + sequenceName: hibernate_sequence + startValue: 1 + incrementBy: 1 + cacheSize: 1 + +- changeSet: + id: 2.postgres.json + author: Michal Michaluk + dbms: postgresql + failOnError: false + changes: + - sql: CREATE CAST (VARCHAR AS JSONB) WITH INOUT AS ASSIGNMENT + rollback: + - sql: DROP CAST (VARCHAR AS JSONB) diff --git a/adapter-commons/src/test/resources/application.properties b/adapter-commons/src/test/resources/application.properties index c006c86..49dc53c 100644 --- a/adapter-commons/src/test/resources/application.properties +++ b/adapter-commons/src/test/resources/application.properties @@ -6,8 +6,7 @@ spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_ON_EXIT=FALSE spring.datasource.username=sa spring.datasource.password=sa spring.datasource.driver-class-name=org.h2.Driver - -spring.liquibase.change-log=classpath:/schema/db.changelog.xml +spring.liquibase.change-log=classpath:/schema/db.changelog.yml logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n logging.level.org.hibernate.SQL=debug diff --git a/app-monolith/Dockerfile b/app-monolith/Dockerfile index ad6efa8..692110f 100644 --- a/app-monolith/Dockerfile +++ b/app-monolith/Dockerfile @@ -1,6 +1,6 @@ -FROM openjdk:8u151-jdk-alpine3.7 +FROM openjdk:8u171-jdk-alpine3.7 MAINTAINER MichaƂ Michaluk EXPOSE 8080 -ADD target/*.jar app.jar +COPY target/app.jar app.jar ENTRYPOINT ["java", "-jar","/app.jar", "--spring.profiles.active=docker"] diff --git a/app-monolith/pom.xml b/app-monolith/pom.xml index c0d545f..83c734d 100644 --- a/app-monolith/pom.xml +++ b/app-monolith/pom.xml @@ -152,6 +152,16 @@ org.springframework.boot spring-boot-maven-plugin + + + + repackage + + + app + + + org.apache.maven.plugins diff --git a/app-monolith/src/main/resources/application.properties b/app-monolith/src/main/resources/application.properties index c7f0ef8..6608d25 100644 --- a/app-monolith/src/main/resources/application.properties +++ b/app-monolith/src/main/resources/application.properties @@ -6,6 +6,6 @@ spring.datasource.url=jdbc:postgresql://localhost:5432/postgres spring.datasource.username=postgres spring.datasource.password=postgres spring.datasource.driver-class-name=org.postgresql.Driver -spring.liquibase.change-log=classpath:/schema/db.changelog.xml +spring.liquibase.change-log=classpath:/schema/db.changelog.yml logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n diff --git a/app-monolith/src/main/resources/schema/db.changelog.xml b/app-monolith/src/main/resources/schema/db.changelog.xml deleted file mode 100644 index f5d9b8e..0000000 --- a/app-monolith/src/main/resources/schema/db.changelog.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/app-monolith/src/main/resources/schema/db.changelog.yml b/app-monolith/src/main/resources/schema/db.changelog.yml new file mode 100644 index 0000000..8eed1a2 --- /dev/null +++ b/app-monolith/src/main/resources/schema/db.changelog.yml @@ -0,0 +1,13 @@ +databaseChangeLog: + - include: + file: /schema/commons.yml + - include: + file: /schema/delivery-planning.yml + - include: + file: /schema/demand-forecasting.yml + - include: + file: /schema/product-management.yml + - include: + file: /schema/production-planning.yml + - include: + file: /schema/shortages-prediction.yml diff --git a/app-monolith/src/main/resources/schema/delivery-planning.xml b/app-monolith/src/main/resources/schema/delivery-planning.xml deleted file mode 100644 index 8012ae9..0000000 --- a/app-monolith/src/main/resources/schema/delivery-planning.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - CREATE SCHEMA delivery_planning - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app-monolith/src/main/resources/schema/demand-forecasting.xml b/app-monolith/src/main/resources/schema/demand-forecasting.xml deleted file mode 100644 index 18b552a..0000000 --- a/app-monolith/src/main/resources/schema/demand-forecasting.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - CREATE SCHEMA demand_forecasting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app-monolith/src/main/resources/schema/product-management.xml b/app-monolith/src/main/resources/schema/product-management.xml deleted file mode 100644 index 8761062..0000000 --- a/app-monolith/src/main/resources/schema/product-management.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - CREATE SCHEMA product_management - - - - - - - - - - - - \ No newline at end of file diff --git a/app-monolith/src/main/resources/schema/production-planning.xml b/app-monolith/src/main/resources/schema/production-planning.xml deleted file mode 100644 index 3e6a323..0000000 --- a/app-monolith/src/main/resources/schema/production-planning.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - CREATE SCHEMA production_planning - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app-monolith/src/main/resources/schema/shortages-prediction.xml b/app-monolith/src/main/resources/schema/shortages-prediction.xml deleted file mode 100644 index 388486a..0000000 --- a/app-monolith/src/main/resources/schema/shortages-prediction.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - CREATE SCHEMA shortages_prediction - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demand-forecasting-adapters/src/main/resources/schema/db.changelog.yml b/demand-forecasting-adapters/src/main/resources/schema/db.changelog.yml new file mode 100644 index 0000000..d02cee2 --- /dev/null +++ b/demand-forecasting-adapters/src/main/resources/schema/db.changelog.yml @@ -0,0 +1,7 @@ +databaseChangeLog: + - include: + file: /schema/commons.yml + - include: + file: /schema/delivery-planning.yml + - include: + file: /schema/demand-forecasting.yml diff --git a/demand-forecasting-adapters/src/main/resources/schema/delivery-planning.xml b/demand-forecasting-adapters/src/main/resources/schema/delivery-planning.xml deleted file mode 100644 index 8012ae9..0000000 --- a/demand-forecasting-adapters/src/main/resources/schema/delivery-planning.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - CREATE SCHEMA delivery_planning - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demand-forecasting-adapters/src/main/resources/schema/delivery-planning.yml b/demand-forecasting-adapters/src/main/resources/schema/delivery-planning.yml new file mode 100644 index 0000000..0dc6168 --- /dev/null +++ b/demand-forecasting-adapters/src/main/resources/schema/delivery-planning.yml @@ -0,0 +1,72 @@ +databaseChangeLog: +- property: + name: json + value: clob + dbms: h2 +- property: + name: json + value: jsonb + dbms: postgresql + +- changeSet: + id: 0.delivery-planning.schema + author: Michal Michaluk + + changes: + - sql: CREATE SCHEMA delivery_planning + rolback: + - sql: DROP SCHEMA delivery_planning + +- changeSet: + id: 1.delivery-planning.init + author: Michal Michaluk + + changes: + - createTable: + schemaName: delivery_planning + tableName: delivery_forecast + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: delivery_forecast_pkey + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + - column: + name: time + type: timestamp + constraints: + nullable: false + - column: + name: date + type: timestamp + constraints: + nullable: false + - column: + name: level + type: bigint + constraints: + nullable: false + + - createTable: + schemaName: delivery_planning + tableName: delivery_planner_definition + columns: + - column: + name: ref_no + type: varchar(64) + constraints: + primaryKey: true + primaryKeyName: delivery_planner_definition_pkey + - column: + name: definition + type: ${json} + constraints: + nullable: false + diff --git a/demand-forecasting-adapters/src/main/resources/schema/demand-forecasting.xml b/demand-forecasting-adapters/src/main/resources/schema/demand-forecasting.xml deleted file mode 100644 index 18b552a..0000000 --- a/demand-forecasting-adapters/src/main/resources/schema/demand-forecasting.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - CREATE SCHEMA demand_forecasting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demand-forecasting-adapters/src/main/resources/schema/demand-forecasting.yml b/demand-forecasting-adapters/src/main/resources/schema/demand-forecasting.yml new file mode 100644 index 0000000..1dd5ff4 --- /dev/null +++ b/demand-forecasting-adapters/src/main/resources/schema/demand-forecasting.yml @@ -0,0 +1,242 @@ +databaseChangeLog: +- property: + name: json + value: clob + dbms: h2 +- property: + name: json + value: jsonb + dbms: postgresql + +- changeSet: + id: 0.demand-forecasting.schema + author: Michal Michaluk + + changes: + - sql: CREATE SCHEMA demand_forecasting + rolback: + - sql: DROP SCHEMA demand_forecasting + +- changeSet: + id: 1.demand_forecasting.init + author: Michal Michaluk + + changes: + - createTable: + schemaName: demand_forecasting + tableName: current_demand + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: current_demand_pkey + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + - column: + name: date + type: timestamp + constraints: + nullable: false + - column: + name: level + type: bigint + constraints: + nullable: false + - column: + name: schema + type: varchar(64) + constraints: + nullable: false + + - addUniqueConstraint: + schemaName: demand_forecasting + tableName: current_demand + columnNames: ref_no, date + constraintName: current_demand_ref_no_date_key + + - createTable: + schemaName: demand_forecasting + tableName: demand + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: demand_pkey + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + - column: + name: date + type: timestamp + constraints: + nullable: false + - column: + name: value + type: ${json} + constraints: + nullable: false + + - addUniqueConstraint: + schemaName: demand_forecasting + tableName: demand + columnNames: ref_no, date + constraintName: demand_ref_no_date_key + + - createTable: + schemaName: demand_forecasting + tableName: demand_adjustment + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: demand_adjustment_pkey + - column: + name: customer_representative + type: varchar(255) + constraints: + nullable: false + - column: + name: note + type: varchar(255) + constraints: + nullable: false + - column: + name: adjustment + type: ${json} + constraints: + nullable: false + - column: + name: clean_after + type: timestamp + + - createTable: + schemaName: demand_forecasting + tableName: product_demand + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: product_demand_pkey + - column: + name: version + type: bigint + constraints: + nullable: false + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + + - addUniqueConstraint: + schemaName: demand_forecasting + tableName: product_demand + columnNames: ref_no + constraintName: product_demand_ref_no_key + + - createTable: + schemaName: demand_forecasting + tableName: demand_review + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: demand_review_pkey + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + - column: + name: date + type: timestamp + constraints: + nullable: false + - column: + name: timestamp + type: timestamp + constraints: + nullable: false + - column: + name: review + type: ${json} + constraints: + nullable: false + - column: + name: decision + type: varchar(64) + - column: + name: clean_after + type: timestamp + +- changeSet: + id: 2.rename.review.table + author: Michal Michaluk + + changes: + - renameTable: + schemaName: demand_forecasting + oldTableName: demand_review + newTableName: required_review + +- changeSet: + id: 3.create.document.table + author: Jakub Pilimon + + changes: + - createTable: + schemaName: demand_forecasting + tableName: document + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + - column: + name: original_uri + type: varchar(1024) + constraints: + nullable: false + - column: + name: stored_uri + type: varchar(1024) + constraints: + nullable: false + - column: + name: saved + type: timestamp + - column: + name: document + type: ${json} + constraints: + nullable: false + - column: + name: clean_after + type: timestamp diff --git a/product-management-adapters/src/main/resources/schema/db.changelog.yml b/product-management-adapters/src/main/resources/schema/db.changelog.yml new file mode 100644 index 0000000..bdc4a2b --- /dev/null +++ b/product-management-adapters/src/main/resources/schema/db.changelog.yml @@ -0,0 +1,5 @@ +databaseChangeLog: + - include: + file: /schema/commons.yml + - include: + file: /schema/product-management.yml diff --git a/product-management-adapters/src/main/resources/schema/product-management.xml b/product-management-adapters/src/main/resources/schema/product-management.xml deleted file mode 100644 index 8761062..0000000 --- a/product-management-adapters/src/main/resources/schema/product-management.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - CREATE SCHEMA product_management - - - - - - - - - - - - \ No newline at end of file diff --git a/product-management-adapters/src/main/resources/schema/product-management.yml b/product-management-adapters/src/main/resources/schema/product-management.yml new file mode 100644 index 0000000..de5aacc --- /dev/null +++ b/product-management-adapters/src/main/resources/schema/product-management.yml @@ -0,0 +1,40 @@ +databaseChangeLog: +- property: + name: json + value: clob + dbms: h2 +- property: + name: json + value: jsonb + dbms: postgresql + + +- changeSet: + id: 0.product-management.schema + author: Michal Michaluk + + changes: + - sql: CREATE SCHEMA product_management + rolback: + - sql: DROP SCHEMA product_management + +- changeSet: + id: 1.product-management.init + author: Michal Michaluk + + changes: + - createTable: + schemaName: product_management + tableName: product_description + columns: + - column: + name: ref_no + type: varchar(64) + constraints: + primaryKey: true + primaryKeyName: product_description_pkey + - column: + name: description + type: ${json} + constraints: + nullable: false diff --git a/production-planning-adapters/src/main/resources/schema/db.changelog.yml b/production-planning-adapters/src/main/resources/schema/db.changelog.yml new file mode 100644 index 0000000..fb6dc8d --- /dev/null +++ b/production-planning-adapters/src/main/resources/schema/db.changelog.yml @@ -0,0 +1,5 @@ +databaseChangeLog: + - include: + file: /schema/commons.yml + - include: + file: /schema/production-planning.yml diff --git a/production-planning-adapters/src/main/resources/schema/production-planning.xml b/production-planning-adapters/src/main/resources/schema/production-planning.xml deleted file mode 100644 index 3e6a323..0000000 --- a/production-planning-adapters/src/main/resources/schema/production-planning.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - CREATE SCHEMA production_planning - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/production-planning-adapters/src/main/resources/schema/production-planning.yml b/production-planning-adapters/src/main/resources/schema/production-planning.yml new file mode 100644 index 0000000..c09a898 --- /dev/null +++ b/production-planning-adapters/src/main/resources/schema/production-planning.yml @@ -0,0 +1,98 @@ +databaseChangeLog: +- property: + name: json + value: clob + dbms: h2 +- property: + name: json + value: jsonb + dbms: postgresql + +- changeSet: + id: 0.production-planning.schema + author: Michal Michaluk + + changes: + - sql: CREATE SCHEMA production_planning + rolback: + - sql: DROP SCHEMA production_planning + +- changeSet: + id: 1.production-planning.init + author: Michal Michaluk + + changes: + - createTable: + schemaName: production_planning + tableName: production_daily_output + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: production_daily_output_pkey + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + - column: + name: date + type: timestamp + constraints: + nullable: false + - column: + name: output + type: bigint + constraints: + nullable: false + + - addUniqueConstraint: + schemaName: production_planning + tableName: production_daily_output + columnNames: ref_no, date + constraintName: production_daily_output_ref_no_date_key + + - createTable: + schemaName: production_planning + tableName: production_output + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: production_output_pkey + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + - column: + name: start + type: timestamp + constraints: + nullable: false + - column: + name: end + type: timestamp + constraints: + nullable: false + - column: + name: duration + type: bigint + constraints: + nullable: false + - column: + name: parts_per_minute + type: integer + constraints: + nullable: false + - column: + name: total + type: bigint + constraints: + nullable: false diff --git a/shortages-prediction-adapters/src/main/resources/schema/db.changelog.yml b/shortages-prediction-adapters/src/main/resources/schema/db.changelog.yml new file mode 100644 index 0000000..39cde93 --- /dev/null +++ b/shortages-prediction-adapters/src/main/resources/schema/db.changelog.yml @@ -0,0 +1,5 @@ +databaseChangeLog: + - include: + file: /schema/commons.yml + - include: + file: /schema/shortages-prediction.yml diff --git a/shortages-prediction-adapters/src/main/resources/schema/shortages-prediction.xml b/shortages-prediction-adapters/src/main/resources/schema/shortages-prediction.xml deleted file mode 100644 index 6bf377e..0000000 --- a/shortages-prediction-adapters/src/main/resources/schema/shortages-prediction.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - CREATE SCHEMA shortages_prediction - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/shortages-prediction-adapters/src/main/resources/schema/shortages-prediction.yml b/shortages-prediction-adapters/src/main/resources/schema/shortages-prediction.yml new file mode 100644 index 0000000..929b340 --- /dev/null +++ b/shortages-prediction-adapters/src/main/resources/schema/shortages-prediction.yml @@ -0,0 +1,78 @@ +databaseChangeLog: +- property: + name: json + value: clob + dbms: h2 +- property: + name: json + value: jsonb + dbms: postgresql + +- changeSet: + id: 0.shortages-prediction.schema + author: Michal Michaluk + + changes: + - sql: CREATE SCHEMA shortages_prediction + rolback: + - sql: DROP SCHEMA shortages_prediction + +- changeSet: + id: 1.shortages-prediction.init + author: Michal Michaluk + + changes: + - createTable: + schemaName: shortages_prediction + tableName: shortage + columns: + - column: + name: id + type: serial + autoIncrement: true + constraints: + primaryKey: true + primaryKeyName: shortage_pkey + - column: + name: version + type: bigint + constraints: + nullable: false + - column: + name: ref_no + type: varchar(64) + constraints: + nullable: false + - column: + name: shortages + type: ${json} + constraints: + nullable: false + + - addUniqueConstraint: + schemaName: shortages_prediction + tableName: shortage + columnNames: ref_no + constraintName: shortage_ref_no_key + + - createTable: + schemaName: shortages_prediction + tableName: stock_forecast + columns: + - column: + name: ref_no + type: varchar(64) + constraints: + primaryKey: true + primaryKeyName: stock_forecast_pkey + +- changeSet: + id: 2.rename.shortages.column + author: Michal Michaluk + + changes: + - renameColumn: + schemaName: shortages_prediction + tableName: shortage + oldColumnName: shortages + newColumnName: shortage