From 0e58ccfe2cc077796d9fbc13538aaa0dc91e9080 Mon Sep 17 00:00:00 2001 From: Timotheus Pokorra Date: Tue, 29 Oct 2024 09:12:27 +0100 Subject: [PATCH] add view for Kimai: hs_integration.time_customer --- .../9-hs-global/9100-hs-integration-schema.sql | 8 ++++++++ .../9-hs-global/9101-integration-kimai.sql | 17 +++++++++++++++++ .../db/changelog/db.changelog-master.yaml | 4 ++++ 3 files changed, 29 insertions(+) create mode 100644 src/main/resources/db/changelog/9-hs-global/9100-hs-integration-schema.sql create mode 100644 src/main/resources/db/changelog/9-hs-global/9101-integration-kimai.sql diff --git a/src/main/resources/db/changelog/9-hs-global/9100-hs-integration-schema.sql b/src/main/resources/db/changelog/9-hs-global/9100-hs-integration-schema.sql new file mode 100644 index 00000000..1f0a8a44 --- /dev/null +++ b/src/main/resources/db/changelog/9-hs-global/9100-hs-integration-schema.sql @@ -0,0 +1,8 @@ +--liquibase formatted sql + + +-- ============================================================================ +--changeset timotheus.pokorra:hs-integration-SCHEMA endDelimiter:--// +-- ---------------------------------------------------------------------------- +CREATE SCHEMA hs_integration; +--// diff --git a/src/main/resources/db/changelog/9-hs-global/9101-integration-kimai.sql b/src/main/resources/db/changelog/9-hs-global/9101-integration-kimai.sql new file mode 100644 index 00000000..895936c1 --- /dev/null +++ b/src/main/resources/db/changelog/9-hs-global/9101-integration-kimai.sql @@ -0,0 +1,17 @@ +--liquibase formatted sql + +-- ============================================================================ +--changeset timotheus.pokorra:hs-global-integration-kimai endDelimiter:--// +CREATE OR REPLACE VIEW hs_integration.time_customer AS + SELECT p.partnernumber, debitor.defaultprefix + FROM hs_office.partner p + JOIN hs_office.relation AS pRel + ON pRel.type = 'PARTNER' + AND pRel.uuid = p.partnerRelUuid + JOIN hs_office.relation AS dRel + ON dRel.type = 'DEBITOR' + AND dRel.anchorUuid = pRel.holderUuid + JOIN hs_office.debitor AS debitor + ON debitor.debitorreluuid = dRel.uuid + AND debitor.debitornumbersuffix = '00'; +--// \ No newline at end of file diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index 78622a51..20fc9193 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -171,3 +171,7 @@ databaseChangeLog: file: db/changelog/7-hs-hosting/701-hosting-asset/7018-hs-hosting-asset-test-data.sql - include: file: db/changelog/9-hs-global/9000-statistics.sql + - include: + file: db/changelog/9-hs-global/9100-hs-integration-schema.sql + - include: + file: db/changelog/9-hs-global/9101-integration-kimai.sql \ No newline at end of file