introduce view tx_journal_v combining tx_journal with tx_context

This commit is contained in:
Michael Hoennig 2024-01-25 16:52:41 +01:00
parent 3c2f607f0b
commit 2aeb8fef6f
11 changed files with 34 additions and 31 deletions

View File

@ -53,6 +53,19 @@ create table tx_journal
create index on tx_journal (targetTable, targetUuid); create index on tx_journal (targetTable, targetUuid);
--// --//
-- ============================================================================
--changeset audit-TX-JOURNAL-VIEW:1 endDelimiter:--//
-- ----------------------------------------------------------------------------
/*
A view combining tx_journal with tx_context.
*/
create view tx_journal_v as
select txc.*, txj.targettable, txj.targetop, txj.targetuuid, txj.targetdelta
from tx_journal txj
left join tx_context txc using (contextid)
order by txc.txtimestamp;
--//
-- ============================================================================ -- ============================================================================
--changeset audit-TX-JOURNAL-TRIGGER:1 endDelimiter:--// --changeset audit-TX-JOURNAL-TRIGGER:1 endDelimiter:--//
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------

View File

@ -279,9 +279,8 @@ class HsOfficeBankAccountRepositoryIntegrationTest extends ContextBasedTest {
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_bankaccount'; where targettable = 'hs_office_bankaccount';
"""); """);

View File

@ -259,9 +259,8 @@ class HsOfficeContactRepositoryIntegrationTest extends ContextBasedTest {
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_contact'; where targettable = 'hs_office_contact';
"""); """);

View File

@ -216,9 +216,8 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_coopassetstransaction'; where targettable = 'hs_office_coopassetstransaction';
"""); """);

View File

@ -215,9 +215,8 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_coopsharestransaction'; where targettable = 'hs_office_coopsharestransaction';
"""); """);

View File

@ -548,10 +548,9 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId where targettable = 'hs_office_coopsharestransaction';
where targettable = 'hs_office_debitor';
"""); """);
// when // when

View File

@ -376,9 +376,8 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_membership'; where targettable = 'hs_office_membership';
"""); """);

View File

@ -443,9 +443,8 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_partner'; where targettable = 'hs_office_partner';
"""); """);

View File

@ -262,9 +262,8 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTest {
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_person'; where targettable = 'hs_office_person';
"""); """);

View File

@ -370,9 +370,8 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_relationship'; where targettable = 'hs_office_relationship';
"""); """);

View File

@ -390,9 +390,8 @@ class HsOfficeSepaMandateRepositoryIntegrationTest extends ContextBasedTest {
public void auditJournalLogIsAvailable() { public void auditJournalLogIsAvailable() {
// given // given
final var query = em.createNativeQuery(""" final var query = em.createNativeQuery("""
select c.currenttask, j.targettable, j.targetop select currentTask, targetTable, targetOp
from tx_journal j from tx_journal_v
join tx_context c on j.contextId = c.contextId
where targettable = 'hs_office_sepamandate'; where targettable = 'hs_office_sepamandate';
"""); """);