From d9a6507d77f0887f3233b773370f81f47377d50f Mon Sep 17 00:00:00 2001 From: Timotheus Pokorra Date: Mon, 14 Oct 2024 12:38:27 +0200 Subject: [PATCH] replace coopsharestransaction_legacy_id with coopsharetx_legacy_id --- .../5116-hs-office-coopshares-migration.sql | 20 +++++++++---------- .../hs/migration/BaseOfficeDataImport.java | 2 +- .../hsadminng/hs/migration/CsvDataImport.java | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/resources/db/changelog/5-hs-office/511-coopshares/5116-hs-office-coopshares-migration.sql b/src/main/resources/db/changelog/5-hs-office/511-coopshares/5116-hs-office-coopshares-migration.sql index 8e620bcd..a13b54ef 100644 --- a/src/main/resources/db/changelog/5-hs-office/511-coopshares/5116-hs-office-coopshares-migration.sql +++ b/src/main/resources/db/changelog/5-hs-office/511-coopshares/5116-hs-office-coopshares-migration.sql @@ -7,7 +7,7 @@ --changeset michael.hoennig:hs-office-coopshares-MIGRATION-mapping endDelimiter:--// -- ---------------------------------------------------------------------------- -CREATE TABLE hs_office.coopsharestransaction_legacy_id +CREATE TABLE hs_office.coopsharetx_legacy_id ( uuid uuid NOT NULL REFERENCES hs_office.coopsharetx(uuid), member_share_id integer NOT NULL @@ -19,10 +19,10 @@ CREATE TABLE hs_office.coopsharestransaction_legacy_id --changeset michael.hoennig:hs-office-coopshares-MIGRATION-sequence endDelimiter:--// -- ---------------------------------------------------------------------------- -CREATE SEQUENCE IF NOT EXISTS hs_office.coopsharestransaction_legacy_id_seq +CREATE SEQUENCE IF NOT EXISTS hs_office.coopsharetx_legacy_id_seq AS integer START 1000000000 - OWNED BY hs_office.coopsharestransaction_legacy_id.member_share_id; + OWNED BY hs_office.coopsharetx_legacy_id.member_share_id; --// @@ -30,9 +30,9 @@ CREATE SEQUENCE IF NOT EXISTS hs_office.coopsharestransaction_legacy_id_seq --changeset michael.hoennig:hs-office-coopshares-MIGRATION-default endDelimiter:--// -- ---------------------------------------------------------------------------- -ALTER TABLE hs_office.coopsharestransaction_legacy_id +ALTER TABLE hs_office.coopsharetx_legacy_id ALTER COLUMN member_share_id - SET DEFAULT nextVal('hs_office.coopsharestransaction_legacy_id_seq'); + SET DEFAULT nextVal('hs_office.coopsharetx_legacy_id_seq'); --/ @@ -41,8 +41,8 @@ ALTER TABLE hs_office.coopsharestransaction_legacy_id -- ---------------------------------------------------------------------------- CALL base.defineContext('schema-migration'); -INSERT INTO hs_office.coopsharestransaction_legacy_id(uuid, member_share_id) - SELECT uuid, nextVal('hs_office.coopsharestransaction_legacy_id_seq') FROM hs_office.coopsharetx; +INSERT INTO hs_office.coopsharetx_legacy_id(uuid, member_share_id) + SELECT uuid, nextVal('hs_office.coopsharetx_legacy_id_seq') FROM hs_office.coopsharetx; --/ @@ -58,8 +58,8 @@ begin raise exception 'invalid usage of trigger'; end if; - INSERT INTO hs_office.coopsharestransaction_legacy_id VALUES - (NEW.uuid, nextVal('hs_office.coopsharestransaction_legacy_id_seq')); + INSERT INTO hs_office.coopsharetx_legacy_id VALUES + (NEW.uuid, nextVal('hs_office.coopsharetx_legacy_id_seq')); return NEW; end; $$; @@ -83,7 +83,7 @@ begin raise exception 'invalid usage of trigger'; end if; - DELETE FROM hs_office.coopsharestransaction_legacy_id + DELETE FROM hs_office.coopsharetx_legacy_id WHERE uuid = OLD.uuid; return OLD; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java index de90103e..2ae7d76e 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java @@ -677,7 +677,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport { jpaAttempt.transacted(() -> { context(rbacSuperuser); coopShares.forEach(this::persist); - updateLegacyIds(coopShares, "hs_office.coopsharestransaction_legacy_id", "member_share_id"); + updateLegacyIds(coopShares, "hs_office.coopsharetx_legacy_id", "member_share_id"); }).assertSuccessful(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/CsvDataImport.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/CsvDataImport.java index d04fc0a5..1f45dcce 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/CsvDataImport.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/CsvDataImport.java @@ -255,7 +255,7 @@ public class CsvDataImport extends ContextBasedTest { em.createNativeQuery("delete from hs_office.coopassettx where true").executeUpdate(); em.createNativeQuery("delete from hs_office.coopassettx_legacy_id where true").executeUpdate(); em.createNativeQuery("delete from hs_office.coopsharetx where true").executeUpdate(); - em.createNativeQuery("delete from hs_office.coopsharestransaction_legacy_id where true").executeUpdate(); + em.createNativeQuery("delete from hs_office.coopsharetx_legacy_id where true").executeUpdate(); em.createNativeQuery("delete from hs_office.membership where true").executeUpdate(); em.createNativeQuery("delete from hs_office.sepamandate where true").executeUpdate(); em.createNativeQuery("delete from hs_office.sepamandate_legacy_id where true").executeUpdate(); @@ -275,7 +275,7 @@ public class CsvDataImport extends ContextBasedTest { em.createNativeQuery("alter sequence hs_office.contact_legacy_id_seq restart with 1000000000;").executeUpdate(); em.createNativeQuery("alter sequence hs_office.coopassettx_legacy_id_seq restart with 1000000000;") .executeUpdate(); - em.createNativeQuery("alter sequence public.hs_office.coopsharestransaction_legacy_id_seq restart with 1000000000;") + em.createNativeQuery("alter sequence public.hs_office.coopsharetx_legacy_id_seq restart with 1000000000;") .executeUpdate(); em.createNativeQuery("alter sequence public.hs_office.partner_legacy_id_seq restart with 1000000000;") .executeUpdate();