diff --git a/app-monolith/pom.xml b/app-monolith/pom.xml
index ebef45f..54f1ca7 100644
--- a/app-monolith/pom.xml
+++ b/app-monolith/pom.xml
@@ -99,6 +99,12 @@
1.1-groovy-2.4
test
+
+ com.h2database
+ h2
+ 1.4.194
+ test
+
net.bytebuddy
byte-buddy
diff --git a/app-monolith/src/main/resources/schema/commons.sql b/app-monolith/src/main/resources/schema/commons.sql
deleted file mode 100644
index 495f961..0000000
--- a/app-monolith/src/main/resources/schema/commons.sql
+++ /dev/null
@@ -1,12 +0,0 @@
---liquibase formatted sql
-
---changeset michaluk.michal:1.init
-
-CREATE SEQUENCE hibernate_sequence
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-CREATE CAST (character varying AS json) WITH INOUT AS ASSIGNMENT;
diff --git a/app-monolith/src/main/resources/schema/commons.xml b/app-monolith/src/main/resources/schema/commons.xml
new file mode 100644
index 0000000..2a2b72c
--- /dev/null
+++ b/app-monolith/src/main/resources/schema/commons.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+ CREATE CAST (character varying AS jsonb) WITH INOUT AS ASSIGNMENT
+
+
diff --git a/app-monolith/src/main/resources/schema/db.changelog.xml b/app-monolith/src/main/resources/schema/db.changelog.xml
index 0e94a27..f5d9b8e 100644
--- a/app-monolith/src/main/resources/schema/db.changelog.xml
+++ b/app-monolith/src/main/resources/schema/db.changelog.xml
@@ -2,10 +2,10 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/app-monolith/src/main/resources/schema/delivery-planning.sql b/app-monolith/src/main/resources/schema/delivery-planning.sql
deleted file mode 100644
index 0b3e86b..0000000
--- a/app-monolith/src/main/resources/schema/delivery-planning.sql
+++ /dev/null
@@ -1,17 +0,0 @@
---liquibase formatted sql
-
---changeset michaluk.michal:1.init
-CREATE SCHEMA delivery_planning;
-
-CREATE TABLE delivery_planning.delivery_planner_definition (
- ref_no character varying(64) NOT NULL PRIMARY KEY,
- definition json NOT NULL
-);
-
-CREATE TABLE delivery_planning.delivery_forecast (
- id serial NOT NULL PRIMARY KEY,
- ref_no character varying(64) NOT NULL,
- "time" timestamp without time zone NOT NULL,
- "date" timestamp without time zone NOT NULL,
- level bigint NOT NULL
-);
diff --git a/app-monolith/src/main/resources/schema/delivery-planning.xml b/app-monolith/src/main/resources/schema/delivery-planning.xml
new file mode 100644
index 0000000..8012ae9
--- /dev/null
+++ b/app-monolith/src/main/resources/schema/delivery-planning.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+ CREATE SCHEMA delivery_planning
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app-monolith/src/main/resources/schema/demand-forecasting.sql b/app-monolith/src/main/resources/schema/demand-forecasting.sql
deleted file mode 100644
index ce91d92..0000000
--- a/app-monolith/src/main/resources/schema/demand-forecasting.sql
+++ /dev/null
@@ -1,49 +0,0 @@
---liquibase formatted sql
-
---changeset michaluk.michal:1.init
-CREATE SCHEMA demand_forecasting;
-
-CREATE TABLE demand_forecasting.product_demand (
- id serial NOT NULL PRIMARY KEY,
- version bigint NOT NULL,
- ref_no character varying(64) NOT NULL,
- UNIQUE(ref_no)
-);
-
-CREATE TABLE demand_forecasting."demand" (
- id serial NOT NULL PRIMARY KEY,
- ref_no character varying(64) NOT NULL,
- "date" timestamp without time zone NOT NULL,
- value json NOT NULL,
- UNIQUE(ref_no, "date")
-);
-
-CREATE TABLE demand_forecasting.current_demand (
- id serial NOT NULL PRIMARY KEY,
- ref_no character varying(64) NOT NULL,
- "date" timestamp without time zone NOT NULL,
- level bigint NOT NULL,
- "schema" character varying(64) NOT NULL,
- UNIQUE(ref_no, "date")
-);
-
-CREATE TABLE demand_forecasting.demand_adjustment (
- id serial NOT NULL PRIMARY KEY,
- customer_representative character varying(255) NOT NULL,
- note character varying(255) NOT NULL,
- adjustment json NOT NULL,
- clean_after timestamp without time zone
-);
-
-CREATE TABLE demand_forecasting.demand_review (
- id serial NOT NULL PRIMARY KEY,
- ref_no character varying(64) NOT NULL,
- "date" timestamp without time zone NOT NULL,
- "timestamp" timestamp without time zone NOT NULL,
- review json NOT NULL,
- decision character varying(64),
- clean_after timestamp without time zone
-);
-
---changeset michaluk.michal:2.rename.review.table
-ALTER TABLE demand_forecasting.demand_review RENAME TO required_review;
diff --git a/app-monolith/src/main/resources/schema/demand-forecasting.xml b/app-monolith/src/main/resources/schema/demand-forecasting.xml
new file mode 100644
index 0000000..18b552a
--- /dev/null
+++ b/app-monolith/src/main/resources/schema/demand-forecasting.xml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+ CREATE SCHEMA demand_forecasting
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app-monolith/src/main/resources/schema/product-management.sql b/app-monolith/src/main/resources/schema/product-management.sql
deleted file mode 100644
index f7b66f5..0000000
--- a/app-monolith/src/main/resources/schema/product-management.sql
+++ /dev/null
@@ -1,9 +0,0 @@
---liquibase formatted sql
-
---changeset michaluk.michal:1.init
-CREATE SCHEMA product_management;
-
-CREATE TABLE product_management.product_description (
- ref_no character varying(64) NOT NULL PRIMARY KEY,
- description json NOT NULL
-);
diff --git a/app-monolith/src/main/resources/schema/product-management.xml b/app-monolith/src/main/resources/schema/product-management.xml
new file mode 100644
index 0000000..8761062
--- /dev/null
+++ b/app-monolith/src/main/resources/schema/product-management.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+ CREATE SCHEMA product_management
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app-monolith/src/main/resources/schema/production-planning.sql b/app-monolith/src/main/resources/schema/production-planning.sql
deleted file mode 100644
index 025cf40..0000000
--- a/app-monolith/src/main/resources/schema/production-planning.sql
+++ /dev/null
@@ -1,22 +0,0 @@
---liquibase formatted sql
-
---changeset michaluk.michal:1.init
-CREATE SCHEMA production_planning;
-
-CREATE TABLE production_planning.production_daily_output (
- id serial NOT NULL PRIMARY KEY,
- ref_no character varying(64) NOT NULL,
- "date" timestamp without time zone NOT NULL,
- output bigint NOT NULL,
- UNIQUE(ref_no, "date")
-);
-
-CREATE TABLE production_planning.production_output (
- id serial NOT NULL PRIMARY KEY,
- ref_no character varying(64) NOT NULL,
- "start" timestamp without time zone NOT NULL,
- "end" timestamp without time zone NOT NULL,
- duration bigint NOT NULL,
- parts_per_minute integer NOT NULL,
- total bigint NOT NULL
-);
diff --git a/app-monolith/src/main/resources/schema/production-planning.xml b/app-monolith/src/main/resources/schema/production-planning.xml
new file mode 100644
index 0000000..3e6a323
--- /dev/null
+++ b/app-monolith/src/main/resources/schema/production-planning.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+ CREATE SCHEMA production_planning
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app-monolith/src/main/resources/schema/shortages-prediction.sql b/app-monolith/src/main/resources/schema/shortages-prediction.sql
deleted file mode 100644
index 95333f3..0000000
--- a/app-monolith/src/main/resources/schema/shortages-prediction.sql
+++ /dev/null
@@ -1,19 +0,0 @@
---liquibase formatted sql
-
---changeset michaluk.michal:1.init
-CREATE SCHEMA shortages_prediction;
-
-CREATE TABLE shortages_prediction.shortage (
- id serial NOT NULL PRIMARY KEY,
- version bigint NOT NULL,
- ref_no character varying(64) NOT NULL,
- shortages json NOT NULL,
- UNIQUE(ref_no)
-);
-
-CREATE TABLE shortages_prediction.stock_forecast (
- ref_no character varying(64) NOT NULL PRIMARY KEY
-);
-
---changeset michaluk.michal:2.rename.shortages.column
-ALTER TABLE shortages_prediction.shortage RENAME shortages TO shortage;
diff --git a/app-monolith/src/main/resources/schema/shortages-prediction.xml b/app-monolith/src/main/resources/schema/shortages-prediction.xml
new file mode 100644
index 0000000..6bf377e
--- /dev/null
+++ b/app-monolith/src/main/resources/schema/shortages-prediction.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+ CREATE SCHEMA shortages_prediction
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app-monolith/src/test/resources/application.properties b/app-monolith/src/test/resources/application.properties
new file mode 100644
index 0000000..5d7b0a5
--- /dev/null
+++ b/app-monolith/src/test/resources/application.properties
@@ -0,0 +1,10 @@
+spring.datasource.driver-class-name=org.h2.Driver
+spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
+spring.datasource.username=sa
+spring.datasource.password=sa
+
+spring.main.banner-mode=off
+spring.jpa.database=default
+spring.jpa.generate-ddl=false
+
+liquibase.change-log=classpath:/schema/db.changelog.xml