From 2bc19f55b56e70643e8b1555a6ffc5c3b5aefd0c Mon Sep 17 00:00:00 2001 From: Silvan Date: Thu, 22 Sep 2022 15:18:52 +0200 Subject: [PATCH] fix(projections): unique index names (#4439) --- internal/query/projection/app.go | 16 ++++++++-------- internal/query/projection/key.go | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/query/projection/app.go b/internal/query/projection/app.go index 2018acb306..7ac25b33f7 100644 --- a/internal/query/projection/app.go +++ b/internal/query/projection/app.go @@ -84,8 +84,8 @@ func newAppProjection(ctx context.Context, config crdb.StatementHandlerConfig) * crdb.NewColumn(AppColumnSequence, crdb.ColumnTypeInt64), }, crdb.NewPrimaryKey(AppColumnInstanceID, AppColumnID), - crdb.WithIndex(crdb.NewIndex("app_project_id_idx", []string{AppColumnProjectID})), - crdb.WithConstraint(crdb.NewConstraint("app_id_unique", []string{AppColumnID})), + crdb.WithIndex(crdb.NewIndex("app3_project_id_idx", []string{AppColumnProjectID})), + crdb.WithConstraint(crdb.NewConstraint("app3_id_unique", []string{AppColumnID})), ), crdb.NewSuffixedTable([]*crdb.Column{ crdb.NewColumn(AppAPIConfigColumnAppID, crdb.ColumnTypeText), @@ -96,8 +96,8 @@ func newAppProjection(ctx context.Context, config crdb.StatementHandlerConfig) * }, crdb.NewPrimaryKey(AppAPIConfigColumnInstanceID, AppAPIConfigColumnAppID), appAPITableSuffix, - crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_api_ref_apps")), - crdb.WithIndex(crdb.NewIndex("api_client_id_idx", []string{AppAPIConfigColumnClientID})), + crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_api_ref_apps3")), + crdb.WithIndex(crdb.NewIndex("api_client_id3_idx", []string{AppAPIConfigColumnClientID})), ), crdb.NewSuffixedTable([]*crdb.Column{ crdb.NewColumn(AppOIDCConfigColumnAppID, crdb.ColumnTypeText), @@ -121,8 +121,8 @@ func newAppProjection(ctx context.Context, config crdb.StatementHandlerConfig) * }, crdb.NewPrimaryKey(AppOIDCConfigColumnInstanceID, AppOIDCConfigColumnAppID), appOIDCTableSuffix, - crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_oidc_ref_apps")), - crdb.WithIndex(crdb.NewIndex("oidc_client_id_idx", []string{AppOIDCConfigColumnClientID})), + crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_oidc_ref_apps3")), + crdb.WithIndex(crdb.NewIndex("oidc_client_id_idx3", []string{AppOIDCConfigColumnClientID})), ), crdb.NewSuffixedTable([]*crdb.Column{ crdb.NewColumn(AppSAMLConfigColumnAppID, crdb.ColumnTypeText), @@ -133,8 +133,8 @@ func newAppProjection(ctx context.Context, config crdb.StatementHandlerConfig) * }, crdb.NewPrimaryKey(AppSAMLConfigColumnInstanceID, AppSAMLConfigColumnAppID), appSAMLTableSuffix, - crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_saml_ref_apps")), - crdb.WithIndex(crdb.NewIndex("saml_entity_id_idx", []string{AppSAMLConfigColumnEntityID})), + crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_saml_ref_apps3")), + crdb.WithIndex(crdb.NewIndex("saml_entity_id_idx3", []string{AppSAMLConfigColumnEntityID})), ), ) p.StatementHandler = crdb.NewStatementHandler(ctx, config) diff --git a/internal/query/projection/key.go b/internal/query/projection/key.go index 1c0698c047..71b4287aa6 100644 --- a/internal/query/projection/key.go +++ b/internal/query/projection/key.go @@ -68,7 +68,7 @@ func newKeyProjection(ctx context.Context, config crdb.StatementHandlerConfig, k crdb.NewColumn(KeyColumnUse, crdb.ColumnTypeEnum, crdb.Default(0)), }, crdb.NewPrimaryKey(KeyColumnInstanceID, KeyColumnID), - crdb.WithConstraint(crdb.NewConstraint("key_id_unique", []string{KeyColumnID})), + crdb.WithConstraint(crdb.NewConstraint("key3_id_unique", []string{KeyColumnID})), ), crdb.NewSuffixedTable([]*crdb.Column{ crdb.NewColumn(KeyPrivateColumnID, crdb.ColumnTypeText), @@ -78,7 +78,7 @@ func newKeyProjection(ctx context.Context, config crdb.StatementHandlerConfig, k }, crdb.NewPrimaryKey(KeyPrivateColumnInstanceID, KeyPrivateColumnID), privateKeyTableSuffix, - crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_private_ref_keys")), + crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_private_ref_keys3")), ), crdb.NewSuffixedTable([]*crdb.Column{ crdb.NewColumn(KeyPublicColumnID, crdb.ColumnTypeText), @@ -88,7 +88,7 @@ func newKeyProjection(ctx context.Context, config crdb.StatementHandlerConfig, k }, crdb.NewPrimaryKey(KeyPublicColumnInstanceID, KeyPublicColumnID), publicKeyTableSuffix, - crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_public_ref_keys")), + crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_public_ref_keys3")), ), crdb.NewSuffixedTable([]*crdb.Column{ crdb.NewColumn(CertificateColumnID, crdb.ColumnTypeText), @@ -98,7 +98,7 @@ func newKeyProjection(ctx context.Context, config crdb.StatementHandlerConfig, k }, crdb.NewPrimaryKey(CertificateColumnInstanceID, CertificateColumnID), certificateTableSuffix, - crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_certificate_ref_keys")), + crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_certificate_ref_keys3")), ), ) p.encryptionAlgorithm = keyEncryptionAlgorithm