From 122e46208019d0d8c2ee9cf8fcb7a82686169892 Mon Sep 17 00:00:00 2001 From: Martin Kaeser Date: Thu, 25 May 2023 14:54:43 +0200 Subject: [PATCH] feat(bridge): Add Flyway migration for SyncRecord --- .../migration/V4_0_0_0__create_sequence.sql | 1 + .../V4_0_0_1__create_sync_records.sql | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 bpdm-bridge-dummy/src/main/resources/db/migration/V4_0_0_0__create_sequence.sql create mode 100644 bpdm-bridge-dummy/src/main/resources/db/migration/V4_0_0_1__create_sync_records.sql diff --git a/bpdm-bridge-dummy/src/main/resources/db/migration/V4_0_0_0__create_sequence.sql b/bpdm-bridge-dummy/src/main/resources/db/migration/V4_0_0_0__create_sequence.sql new file mode 100644 index 000000000..5f332f4b8 --- /dev/null +++ b/bpdm-bridge-dummy/src/main/resources/db/migration/V4_0_0_0__create_sequence.sql @@ -0,0 +1 @@ +CREATE SEQUENCE IF NOT EXISTS bpdm_sequence START WITH 1 INCREMENT BY 1; diff --git a/bpdm-bridge-dummy/src/main/resources/db/migration/V4_0_0_1__create_sync_records.sql b/bpdm-bridge-dummy/src/main/resources/db/migration/V4_0_0_1__create_sync_records.sql new file mode 100644 index 000000000..d5fb34194 --- /dev/null +++ b/bpdm-bridge-dummy/src/main/resources/db/migration/V4_0_0_1__create_sync_records.sql @@ -0,0 +1,23 @@ +CREATE TABLE sync_records +( + id BIGINT NOT NULL, + uuid UUID NOT NULL, + created_at TIMESTAMP with time zone NOT NULL, + updated_at TIMESTAMP with time zone NOT NULL, + type VARCHAR(255) NOT NULL, + status VARCHAR(255) NOT NULL, + progress FLOAT NOT NULL, + count INTEGER NOT NULL, + status_details VARCHAR(255), + save_state VARCHAR(255), + started_at TIMESTAMP with time zone, + finished_at TIMESTAMP with time zone, + from_time TIMESTAMP with time zone, + CONSTRAINT pk_sync_records PRIMARY KEY (id) +); + +ALTER TABLE sync_records + ADD CONSTRAINT uc_sync_records_type UNIQUE (type); + +ALTER TABLE sync_records + ADD CONSTRAINT uc_sync_records_uuid UNIQUE (uuid);