From 970c062307b0d1197d2c53e4f1c65f73b124df61 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Wed, 6 Dec 2023 12:30:56 +0200 Subject: [PATCH] fix: projection version of restrictions (#7028) --- internal/query/projection/restrictions.go | 2 +- internal/query/projection/restrictions_test.go | 4 ++-- internal/query/restrictions_test.go | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/query/projection/restrictions.go b/internal/query/projection/restrictions.go index 81f8bc7cc2..44bf97c5d0 100644 --- a/internal/query/projection/restrictions.go +++ b/internal/query/projection/restrictions.go @@ -12,7 +12,7 @@ import ( ) const ( - RestrictionsProjectionTable = "projections.restrictions" + RestrictionsProjectionTable = "projections.restrictions2" RestrictionsColumnAggregateID = "aggregate_id" RestrictionsColumnCreationDate = "creation_date" diff --git a/internal/query/projection/restrictions_test.go b/internal/query/projection/restrictions_test.go index 6a0a678f70..a9058b17b0 100644 --- a/internal/query/projection/restrictions_test.go +++ b/internal/query/projection/restrictions_test.go @@ -35,7 +35,7 @@ func TestRestrictionsProjection_reduces(t *testing.T) { executer: &testExecuter{ executions: []execution{ { - expectedStmt: "INSERT INTO projections.restrictions (instance_id, resource_owner, creation_date, change_date, sequence, aggregate_id, disallow_public_org_registration) VALUES ($1, $2, $3, $4, $5, $6, $7) ON CONFLICT (instance_id, resource_owner) DO UPDATE SET (creation_date, change_date, sequence, aggregate_id, disallow_public_org_registration) = (projections.restrictions.creation_date, EXCLUDED.change_date, EXCLUDED.sequence, EXCLUDED.aggregate_id, EXCLUDED.disallow_public_org_registration)", + expectedStmt: "INSERT INTO projections.restrictions2 (instance_id, resource_owner, creation_date, change_date, sequence, aggregate_id, disallow_public_org_registration) VALUES ($1, $2, $3, $4, $5, $6, $7) ON CONFLICT (instance_id, resource_owner) DO UPDATE SET (creation_date, change_date, sequence, aggregate_id, disallow_public_org_registration) = (projections.restrictions2.creation_date, EXCLUDED.change_date, EXCLUDED.sequence, EXCLUDED.aggregate_id, EXCLUDED.disallow_public_org_registration)", expectedArgs: []interface{}{ "instance-id", "ro-id", @@ -66,7 +66,7 @@ func TestRestrictionsProjection_reduces(t *testing.T) { executer: &testExecuter{ executions: []execution{ { - expectedStmt: "INSERT INTO projections.restrictions (instance_id, resource_owner, creation_date, change_date, sequence, aggregate_id) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (instance_id, resource_owner) DO UPDATE SET (creation_date, change_date, sequence, aggregate_id) = (projections.restrictions.creation_date, EXCLUDED.change_date, EXCLUDED.sequence, EXCLUDED.aggregate_id)", + expectedStmt: "INSERT INTO projections.restrictions2 (instance_id, resource_owner, creation_date, change_date, sequence, aggregate_id) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (instance_id, resource_owner) DO UPDATE SET (creation_date, change_date, sequence, aggregate_id) = (projections.restrictions2.creation_date, EXCLUDED.change_date, EXCLUDED.sequence, EXCLUDED.aggregate_id)", expectedArgs: []interface{}{ "instance-id", "ro-id", diff --git a/internal/query/restrictions_test.go b/internal/query/restrictions_test.go index db53bf36fd..cc7ee8442a 100644 --- a/internal/query/restrictions_test.go +++ b/internal/query/restrictions_test.go @@ -14,14 +14,14 @@ import ( ) var ( - expectedRestrictionsQuery = regexp.QuoteMeta("SELECT projections.restrictions.aggregate_id," + - " projections.restrictions.creation_date," + - " projections.restrictions.change_date," + - " projections.restrictions.resource_owner," + - " projections.restrictions.sequence," + - " projections.restrictions.disallow_public_org_registration," + - " projections.restrictions.allowed_languages" + - " FROM projections.restrictions" + + expectedRestrictionsQuery = regexp.QuoteMeta("SELECT projections.restrictions2.aggregate_id," + + " projections.restrictions2.creation_date," + + " projections.restrictions2.change_date," + + " projections.restrictions2.resource_owner," + + " projections.restrictions2.sequence," + + " projections.restrictions2.disallow_public_org_registration," + + " projections.restrictions2.allowed_languages" + + " FROM projections.restrictions2" + " AS OF SYSTEM TIME '-1 ms'", )