From e142bc7383de6ef4f44dce4ce5ef969a24d53870 Mon Sep 17 00:00:00 2001 From: saba_zedginidze Date: Mon, 4 Nov 2024 16:37:26 +0400 Subject: [PATCH] [MODINVOSTO-187] Create outbox log and internal lock tables --- src/main/resources/templates/db_scripts/schema.json | 10 ++++++++++ .../db_scripts/tables/create_audit_outbox_table.sql | 6 ++++++ .../db_scripts/tables/create_internal_lock_table.sql | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 src/main/resources/templates/db_scripts/tables/create_audit_outbox_table.sql create mode 100644 src/main/resources/templates/db_scripts/tables/create_internal_lock_table.sql diff --git a/src/main/resources/templates/db_scripts/schema.json b/src/main/resources/templates/db_scripts/schema.json index a7c9dd9d..8b90e8ea 100644 --- a/src/main/resources/templates/db_scripts/schema.json +++ b/src/main/resources/templates/db_scripts/schema.json @@ -84,6 +84,16 @@ "run": "after", "snippetPath": "invoices_table.sql", "fromModuleVersion": "mod-invoice-storage-5.9.0" + }, + { + "run": "after", + "snippetPath": "tables/create_audit_outbox_table.sql", + "fromModuleVersion": "mod-invoice-storage-5.9.0" + }, + { + "run": "after", + "snippetPath": "tables/create_internal_lock_table.sql", + "fromModuleVersion": "mod-invoice-storage-5.9.0" } ], "tables": [ diff --git a/src/main/resources/templates/db_scripts/tables/create_audit_outbox_table.sql b/src/main/resources/templates/db_scripts/tables/create_audit_outbox_table.sql new file mode 100644 index 00000000..ff31c93e --- /dev/null +++ b/src/main/resources/templates/db_scripts/tables/create_audit_outbox_table.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS outbox_event_log ( + event_id uuid NOT NULL PRIMARY KEY, + entity_type text NOT NULL, + action text NOT NULL, + payload jsonb +); diff --git a/src/main/resources/templates/db_scripts/tables/create_internal_lock_table.sql b/src/main/resources/templates/db_scripts/tables/create_internal_lock_table.sql new file mode 100644 index 00000000..a441d415 --- /dev/null +++ b/src/main/resources/templates/db_scripts/tables/create_internal_lock_table.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS internal_lock ( + lock_name text NOT NULL PRIMARY KEY +); + +INSERT INTO internal_lock(lock_name) VALUES ('audit_outbox') ON CONFLICT DO NOTHING;