TP-20240927-importfixes #115
@ -7,7 +7,7 @@
|
|||||||
--changeset michael.hoennig:hs-office-coopshares-MIGRATION-mapping endDelimiter:--//
|
--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),
|
uuid uuid NOT NULL REFERENCES hs_office.coopsharetx(uuid),
|
||||||
member_share_id integer NOT NULL
|
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:--//
|
--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
|
AS integer
|
||||||
START 1000000000
|
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:--//
|
--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
|
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');
|
CALL base.defineContext('schema-migration');
|
||||||
INSERT INTO hs_office.coopsharestransaction_legacy_id(uuid, member_share_id)
|
INSERT INTO hs_office.coopsharetx_legacy_id(uuid, member_share_id)
|
||||||
SELECT uuid, nextVal('hs_office.coopsharestransaction_legacy_id_seq') FROM hs_office.coopsharetx;
|
SELECT uuid, nextVal('hs_office.coopsharetx_legacy_id_seq') FROM hs_office.coopsharetx;
|
||||||
--/
|
--/
|
||||||
|
|
||||||
|
|
||||||
@ -58,8 +58,8 @@ begin
|
|||||||
raise exception 'invalid usage of trigger';
|
raise exception 'invalid usage of trigger';
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
INSERT INTO hs_office.coopsharestransaction_legacy_id VALUES
|
INSERT INTO hs_office.coopsharetx_legacy_id VALUES
|
||||||
(NEW.uuid, nextVal('hs_office.coopsharestransaction_legacy_id_seq'));
|
(NEW.uuid, nextVal('hs_office.coopsharetx_legacy_id_seq'));
|
||||||
|
|
||||||
return NEW;
|
return NEW;
|
||||||
end; $$;
|
end; $$;
|
||||||
@ -83,7 +83,7 @@ begin
|
|||||||
raise exception 'invalid usage of trigger';
|
raise exception 'invalid usage of trigger';
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
DELETE FROM hs_office.coopsharestransaction_legacy_id
|
DELETE FROM hs_office.coopsharetx_legacy_id
|
||||||
WHERE uuid = OLD.uuid;
|
WHERE uuid = OLD.uuid;
|
||||||
|
|
||||||
return OLD;
|
return OLD;
|
||||||
|
@ -677,7 +677,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
|
|||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
context(rbacSuperuser);
|
context(rbacSuperuser);
|
||||||
coopShares.forEach(this::persist);
|
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();
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
@ -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 where true").executeUpdate();
|
||||||
em.createNativeQuery("delete from hs_office.coopassettx_legacy_id 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.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.membership where true").executeUpdate();
|
||||||
em.createNativeQuery("delete from hs_office.sepamandate 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();
|
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.contact_legacy_id_seq restart with 1000000000;").executeUpdate();
|
||||||
em.createNativeQuery("alter sequence hs_office.coopassettx_legacy_id_seq restart with 1000000000;")
|
em.createNativeQuery("alter sequence hs_office.coopassettx_legacy_id_seq restart with 1000000000;")
|
||||||
.executeUpdate();
|
.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();
|
.executeUpdate();
|
||||||
em.createNativeQuery("alter sequence public.hs_office.partner_legacy_id_seq restart with 1000000000;")
|
em.createNativeQuery("alter sequence public.hs_office.partner_legacy_id_seq restart with 1000000000;")
|
||||||
.executeUpdate();
|
.executeUpdate();
|
||||||
|
Loading…
Reference in New Issue
Block a user