From 0d0a913466ee57082cae2e34196bd4592e2aee76 Mon Sep 17 00:00:00 2001
From: Timotheus Pokorra <timotheus.pokorra@solidcharity.com>
Date: Thu, 23 Jan 2025 09:39:02 +0100
Subject: [PATCH 1/2] create database only with office tables

---
 .../db/changelog/db.changelog-master.yaml     | 76 -------------------
 .../hsadminng/hs/migration/CsvDataImport.java |  4 +
 2 files changed, 4 insertions(+), 76 deletions(-)

diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml
index 2eb8908c..325c3c3e 100644
--- a/src/main/resources/db/changelog/db.changelog-master.yaml
+++ b/src/main/resources/db/changelog/db.changelog-master.yaml
@@ -51,37 +51,6 @@ databaseChangeLog:
     - include:
         file: db/changelog/1-rbac/1080-rbac-global.sql
 
-    - include:
-        file: db/changelog/2-rbactest/200-rbactest-schema.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/201-rbactest-customer/2010-rbactest-customer.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/201-rbactest-customer/2013-rbactest-customer-rbac.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/201-rbactest-customer/2018-rbactest-customer-test-data.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/202-rbactest-package/2020-rbactest-package.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/202-rbactest-package/2023-rbactest-package-rbac.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/202-rbactest-package/2028-rbactest-package-test-data.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/203-rbactest-domain/2030-rbactest-domain.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/203-rbactest-domain/2033-rbactest-domain-rbac.sql
-        context: "!without-test-data"
-    - include:
-        file: db/changelog/2-rbactest/203-rbactest-domain/2038-rbactest-domain-test-data.sql
-        context: "!without-test-data"
-
     - include:
         file: db/changelog/5-hs-office/500-hs-office-schema.sql
     - include:
@@ -167,51 +136,6 @@ databaseChangeLog:
         file: db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql
         context: "!without-test-data"
 
-    - include:
-        file: db/changelog/6-hs-booking/600-hs-booking-schema.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/6-hs-booking/610-booking-debitor/6100-hs-booking-debitor.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/6-hs-booking/620-booking-project/6200-hs-booking-project.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/6-hs-booking/620-booking-project/6203-hs-booking-project-rbac.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/6-hs-booking/620-booking-project/6208-hs-booking-project-test-data.sql
-        context: "!only-office and !without-test-data"
-    - include:
-        file: db/changelog/6-hs-booking/630-booking-item/6300-hs-booking-item.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/6-hs-booking/630-booking-item/6303-hs-booking-item-rbac.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/6-hs-booking/630-booking-item/6308-hs-booking-item-test-data.sql
-        context: "!only-office and !without-test-data"
-
-    - include:
-        file: db/changelog/7-hs-hosting/700-hs-hosting-schema.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/7-hs-hosting/701-hosting-asset/7010-hs-hosting-asset.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/7-hs-hosting/701-hosting-asset/7013-hs-hosting-asset-rbac.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/7-hs-hosting/701-hosting-asset/7016-hs-hosting-asset-migration.sql
-        context: "!only-office"
-    - include:
-        file: db/changelog/7-hs-hosting/701-hosting-asset/7018-hs-hosting-asset-test-data.sql
-        context: "!only-office and !without-test-data"
-
-    - include:
-        file: db/changelog/9-hs-global/9000-statistics.sql
-        context: "!only-office"
-
     - include:
         file: db/changelog/9-hs-global/9100-hs-integration-schema.sql
     - include:
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 811f3752..dd007c17 100644
--- a/src/test/java/net/hostsharing/hsadminng/hs/migration/CsvDataImport.java
+++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/CsvDataImport.java
@@ -252,12 +252,14 @@ public class CsvDataImport extends ContextBasedTest {
         jpaAttempt.transacted(() -> {
             context(rbacSuperuser);
             // TODO.perf: could we instead skip creating test-data based on an env var?
+            /*
             em.createNativeQuery("delete from hs_hosting.asset where true").executeUpdate();
             em.createNativeQuery("delete from hs_hosting.asset_ex where true").executeUpdate();
             em.createNativeQuery("delete from hs_booking.item where true").executeUpdate();
             em.createNativeQuery("delete from hs_booking.item_ex where true").executeUpdate();
             em.createNativeQuery("delete from hs_booking.project where true").executeUpdate();
             em.createNativeQuery("delete from hs_booking.project_ex 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.coopsharetx where true").executeUpdate();
@@ -293,9 +295,11 @@ public class CsvDataImport extends ContextBasedTest {
     protected void deleteFromTestTables() {
         jpaAttempt.transacted(() -> {
             context(rbacSuperuser);
+            /*
             em.createNativeQuery("delete from rbactest.domain where true").executeUpdate();
             em.createNativeQuery("delete from rbactest.package where true").executeUpdate();
             em.createNativeQuery("delete from rbactest.customer where true").executeUpdate();
+            */
         }).assertSuccessful();
     }
 

From e8e3b24fb958a882a4c2ae4ff4a557d8ab6b2e14 Mon Sep 17 00:00:00 2001
From: Timotheus Pokorra <timotheus.pokorra@solidcharity.com>
Date: Wed, 29 Jan 2025 09:24:35 +0100
Subject: [PATCH 2/2] fix name of changeset for mlmmj

---
 .../db/changelog/9-hs-global/9130-integration-mlmmj.sql         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/resources/db/changelog/9-hs-global/9130-integration-mlmmj.sql b/src/main/resources/db/changelog/9-hs-global/9130-integration-mlmmj.sql
index a7ab0d9e..22e814f0 100644
--- a/src/main/resources/db/changelog/9-hs-global/9130-integration-mlmmj.sql
+++ b/src/main/resources/db/changelog/9-hs-global/9130-integration-mlmmj.sql
@@ -2,7 +2,7 @@
 --liquibase formatted sql
 
 -- ============================================================================
---changeset timotheus.pokorra:hs-global-integration-znuny endDelimiter:--//
+--changeset timotheus.pokorra:hs-global-integration-mlmmj endDelimiter:--//
 CREATE OR REPLACE VIEW hs_integration.subscription AS
   SELECT DISTINCT
     relation.mark as subscription,