From 07149cafd85e7bb50fd2019d091256b0d534c7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B8=D0=BC=D0=B8=D0=BD?= Date: Sun, 3 May 2026 23:51:30 +0300 Subject: [PATCH] fix(migrations): add Envers revinfo + dictionary_records_aud (0010) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit App падал на 'relation revinfo_seq does not exist' — Hibernate Envers ожидает revinfo_seq + revinfo + _aud, а hibernate.hbm2ddl.auto=none не позволяет автогенерацию. Создаём вручную: - revinfo_seq (sequence) - revinfo (rev INTEGER PK, revtstmp BIGINT) - dictionary_records_aud (зеркало + rev, revtype, id+rev composite PK) --- .../changelog/changes/0010-envers-tables.xml | 73 +++++++++++++++++++ .../main/resources/db/changelog/master.xml | 1 + 2 files changed, 74 insertions(+) create mode 100644 ordinis-migrations/src/main/resources/db/changelog/changes/0010-envers-tables.xml diff --git a/ordinis-migrations/src/main/resources/db/changelog/changes/0010-envers-tables.xml b/ordinis-migrations/src/main/resources/db/changelog/changes/0010-envers-tables.xml new file mode 100644 index 0000000..2b06ef6 --- /dev/null +++ b/ordinis-migrations/src/main/resources/db/changelog/changes/0010-envers-tables.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Зеркало dictionary_records + (rev, revtype) для Envers audit. + + CREATE TABLE dictionary_records_aud ( + id UUID NOT NULL, + rev INTEGER NOT NULL REFERENCES revinfo(rev), + revtype SMALLINT, + dictionary_id UUID, + business_key VARCHAR(256), + data JSONB, + geometry GEOMETRY(Geometry, 4326), + data_scope VARCHAR(32), + valid_from TIMESTAMPTZ, + valid_to TIMESTAMPTZ, + created_at TIMESTAMPTZ, + updated_at TIMESTAMPTZ, + created_by VARCHAR(128), + updated_by VARCHAR(128), + version BIGINT, + PRIMARY KEY (id, rev) + ); + CREATE INDEX idx_dict_records_aud_rev ON dictionary_records_aud(rev); + CREATE INDEX idx_dict_records_aud_id ON dictionary_records_aud(id); + + + + diff --git a/ordinis-migrations/src/main/resources/db/changelog/master.xml b/ordinis-migrations/src/main/resources/db/changelog/master.xml index 2e11263..c20282f 100644 --- a/ordinis-migrations/src/main/resources/db/changelog/master.xml +++ b/ordinis-migrations/src/main/resources/db/changelog/master.xml @@ -14,5 +14,6 @@ +