fix: remove idp templates when using old / deprecated delete method (#5685)

* fix: remove idp templates when using old / deprecated delete method

* fix: projection version
This commit is contained in:
Livio Spring 2023-04-17 10:20:49 +02:00 committed by GitHub
parent 4c482619da
commit 429a91518b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 324 additions and 268 deletions

View File

@ -13,12 +13,12 @@ import (
var (
loginPolicyIDPLinksQuery = regexp.QuoteMeta(`SELECT projections.idp_login_policy_links5.idp_id,` +
` projections.idp_templates4.name,` +
` projections.idp_templates4.type,` +
` projections.idp_templates4.owner_type,` +
` projections.idp_templates5.name,` +
` projections.idp_templates5.type,` +
` projections.idp_templates5.owner_type,` +
` COUNT(*) OVER ()` +
` FROM projections.idp_login_policy_links5` +
` LEFT JOIN projections.idp_templates4 ON projections.idp_login_policy_links5.idp_id = projections.idp_templates4.id AND projections.idp_login_policy_links5.instance_id = projections.idp_templates4.instance_id` +
` LEFT JOIN projections.idp_templates5 ON projections.idp_login_policy_links5.idp_id = projections.idp_templates5.id AND projections.idp_login_policy_links5.instance_id = projections.idp_templates5.instance_id` +
` AS OF SYSTEM TIME '-1 ms'`)
loginPolicyIDPLinksCols = []string{
"idp_id",

View File

@ -16,112 +16,112 @@ import (
)
var (
idpTemplateQuery = `SELECT projections.idp_templates4.id,` +
` projections.idp_templates4.resource_owner,` +
` projections.idp_templates4.creation_date,` +
` projections.idp_templates4.change_date,` +
` projections.idp_templates4.sequence,` +
` projections.idp_templates4.state,` +
` projections.idp_templates4.name,` +
` projections.idp_templates4.type,` +
` projections.idp_templates4.owner_type,` +
` projections.idp_templates4.is_creation_allowed,` +
` projections.idp_templates4.is_linking_allowed,` +
` projections.idp_templates4.is_auto_creation,` +
` projections.idp_templates4.is_auto_update,` +
idpTemplateQuery = `SELECT projections.idp_templates5.id,` +
` projections.idp_templates5.resource_owner,` +
` projections.idp_templates5.creation_date,` +
` projections.idp_templates5.change_date,` +
` projections.idp_templates5.sequence,` +
` projections.idp_templates5.state,` +
` projections.idp_templates5.name,` +
` projections.idp_templates5.type,` +
` projections.idp_templates5.owner_type,` +
` projections.idp_templates5.is_creation_allowed,` +
` projections.idp_templates5.is_linking_allowed,` +
` projections.idp_templates5.is_auto_creation,` +
` projections.idp_templates5.is_auto_update,` +
// oauth
` projections.idp_templates4_oauth2.idp_id,` +
` projections.idp_templates4_oauth2.client_id,` +
` projections.idp_templates4_oauth2.client_secret,` +
` projections.idp_templates4_oauth2.authorization_endpoint,` +
` projections.idp_templates4_oauth2.token_endpoint,` +
` projections.idp_templates4_oauth2.user_endpoint,` +
` projections.idp_templates4_oauth2.scopes,` +
` projections.idp_templates4_oauth2.id_attribute,` +
` projections.idp_templates5_oauth2.idp_id,` +
` projections.idp_templates5_oauth2.client_id,` +
` projections.idp_templates5_oauth2.client_secret,` +
` projections.idp_templates5_oauth2.authorization_endpoint,` +
` projections.idp_templates5_oauth2.token_endpoint,` +
` projections.idp_templates5_oauth2.user_endpoint,` +
` projections.idp_templates5_oauth2.scopes,` +
` projections.idp_templates5_oauth2.id_attribute,` +
// oidc
` projections.idp_templates4_oidc.idp_id,` +
` projections.idp_templates4_oidc.issuer,` +
` projections.idp_templates4_oidc.client_id,` +
` projections.idp_templates4_oidc.client_secret,` +
` projections.idp_templates4_oidc.scopes,` +
` projections.idp_templates4_oidc.id_token_mapping,` +
` projections.idp_templates5_oidc.idp_id,` +
` projections.idp_templates5_oidc.issuer,` +
` projections.idp_templates5_oidc.client_id,` +
` projections.idp_templates5_oidc.client_secret,` +
` projections.idp_templates5_oidc.scopes,` +
` projections.idp_templates5_oidc.id_token_mapping,` +
// jwt
` projections.idp_templates4_jwt.idp_id,` +
` projections.idp_templates4_jwt.issuer,` +
` projections.idp_templates4_jwt.jwt_endpoint,` +
` projections.idp_templates4_jwt.keys_endpoint,` +
` projections.idp_templates4_jwt.header_name,` +
` projections.idp_templates5_jwt.idp_id,` +
` projections.idp_templates5_jwt.issuer,` +
` projections.idp_templates5_jwt.jwt_endpoint,` +
` projections.idp_templates5_jwt.keys_endpoint,` +
` projections.idp_templates5_jwt.header_name,` +
// azure
` projections.idp_templates4_azure.idp_id,` +
` projections.idp_templates4_azure.client_id,` +
` projections.idp_templates4_azure.client_secret,` +
` projections.idp_templates4_azure.scopes,` +
` projections.idp_templates4_azure.tenant,` +
` projections.idp_templates4_azure.is_email_verified,` +
` projections.idp_templates5_azure.idp_id,` +
` projections.idp_templates5_azure.client_id,` +
` projections.idp_templates5_azure.client_secret,` +
` projections.idp_templates5_azure.scopes,` +
` projections.idp_templates5_azure.tenant,` +
` projections.idp_templates5_azure.is_email_verified,` +
// github
` projections.idp_templates4_github.idp_id,` +
` projections.idp_templates4_github.client_id,` +
` projections.idp_templates4_github.client_secret,` +
` projections.idp_templates4_github.scopes,` +
` projections.idp_templates5_github.idp_id,` +
` projections.idp_templates5_github.client_id,` +
` projections.idp_templates5_github.client_secret,` +
` projections.idp_templates5_github.scopes,` +
// github enterprise
` projections.idp_templates4_github_enterprise.idp_id,` +
` projections.idp_templates4_github_enterprise.client_id,` +
` projections.idp_templates4_github_enterprise.client_secret,` +
` projections.idp_templates4_github_enterprise.authorization_endpoint,` +
` projections.idp_templates4_github_enterprise.token_endpoint,` +
` projections.idp_templates4_github_enterprise.user_endpoint,` +
` projections.idp_templates4_github_enterprise.scopes,` +
` projections.idp_templates5_github_enterprise.idp_id,` +
` projections.idp_templates5_github_enterprise.client_id,` +
` projections.idp_templates5_github_enterprise.client_secret,` +
` projections.idp_templates5_github_enterprise.authorization_endpoint,` +
` projections.idp_templates5_github_enterprise.token_endpoint,` +
` projections.idp_templates5_github_enterprise.user_endpoint,` +
` projections.idp_templates5_github_enterprise.scopes,` +
// gitlab
` projections.idp_templates4_gitlab.idp_id,` +
` projections.idp_templates4_gitlab.client_id,` +
` projections.idp_templates4_gitlab.client_secret,` +
` projections.idp_templates4_gitlab.scopes,` +
` projections.idp_templates5_gitlab.idp_id,` +
` projections.idp_templates5_gitlab.client_id,` +
` projections.idp_templates5_gitlab.client_secret,` +
` projections.idp_templates5_gitlab.scopes,` +
// gitlab self hosted
` projections.idp_templates4_gitlab_self_hosted.idp_id,` +
` projections.idp_templates4_gitlab_self_hosted.issuer,` +
` projections.idp_templates4_gitlab_self_hosted.client_id,` +
` projections.idp_templates4_gitlab_self_hosted.client_secret,` +
` projections.idp_templates4_gitlab_self_hosted.scopes,` +
` projections.idp_templates5_gitlab_self_hosted.idp_id,` +
` projections.idp_templates5_gitlab_self_hosted.issuer,` +
` projections.idp_templates5_gitlab_self_hosted.client_id,` +
` projections.idp_templates5_gitlab_self_hosted.client_secret,` +
` projections.idp_templates5_gitlab_self_hosted.scopes,` +
// google
` projections.idp_templates4_google.idp_id,` +
` projections.idp_templates4_google.client_id,` +
` projections.idp_templates4_google.client_secret,` +
` projections.idp_templates4_google.scopes,` +
` projections.idp_templates5_google.idp_id,` +
` projections.idp_templates5_google.client_id,` +
` projections.idp_templates5_google.client_secret,` +
` projections.idp_templates5_google.scopes,` +
// ldap
` projections.idp_templates4_ldap2.idp_id,` +
` projections.idp_templates4_ldap2.servers,` +
` projections.idp_templates4_ldap2.start_tls,` +
` projections.idp_templates4_ldap2.base_dn,` +
` projections.idp_templates4_ldap2.bind_dn,` +
` projections.idp_templates4_ldap2.bind_password,` +
` projections.idp_templates4_ldap2.user_base,` +
` projections.idp_templates4_ldap2.user_object_classes,` +
` projections.idp_templates4_ldap2.user_filters,` +
` projections.idp_templates4_ldap2.timeout,` +
` projections.idp_templates4_ldap2.id_attribute,` +
` projections.idp_templates4_ldap2.first_name_attribute,` +
` projections.idp_templates4_ldap2.last_name_attribute,` +
` projections.idp_templates4_ldap2.display_name_attribute,` +
` projections.idp_templates4_ldap2.nick_name_attribute,` +
` projections.idp_templates4_ldap2.preferred_username_attribute,` +
` projections.idp_templates4_ldap2.email_attribute,` +
` projections.idp_templates4_ldap2.email_verified,` +
` projections.idp_templates4_ldap2.phone_attribute,` +
` projections.idp_templates4_ldap2.phone_verified_attribute,` +
` projections.idp_templates4_ldap2.preferred_language_attribute,` +
` projections.idp_templates4_ldap2.avatar_url_attribute,` +
` projections.idp_templates4_ldap2.profile_attribute` +
` FROM projections.idp_templates4` +
` LEFT JOIN projections.idp_templates4_oauth2 ON projections.idp_templates4.id = projections.idp_templates4_oauth2.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_oauth2.instance_id` +
` LEFT JOIN projections.idp_templates4_oidc ON projections.idp_templates4.id = projections.idp_templates4_oidc.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_oidc.instance_id` +
` LEFT JOIN projections.idp_templates4_jwt ON projections.idp_templates4.id = projections.idp_templates4_jwt.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_jwt.instance_id` +
` LEFT JOIN projections.idp_templates4_azure ON projections.idp_templates4.id = projections.idp_templates4_azure.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_azure.instance_id` +
` LEFT JOIN projections.idp_templates4_github ON projections.idp_templates4.id = projections.idp_templates4_github.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_github.instance_id` +
` LEFT JOIN projections.idp_templates4_github_enterprise ON projections.idp_templates4.id = projections.idp_templates4_github_enterprise.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_github_enterprise.instance_id` +
` LEFT JOIN projections.idp_templates4_gitlab ON projections.idp_templates4.id = projections.idp_templates4_gitlab.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_gitlab.instance_id` +
` LEFT JOIN projections.idp_templates4_gitlab_self_hosted ON projections.idp_templates4.id = projections.idp_templates4_gitlab_self_hosted.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_gitlab_self_hosted.instance_id` +
` LEFT JOIN projections.idp_templates4_google ON projections.idp_templates4.id = projections.idp_templates4_google.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_google.instance_id` +
` LEFT JOIN projections.idp_templates4_ldap2 ON projections.idp_templates4.id = projections.idp_templates4_ldap2.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_ldap2.instance_id` +
` projections.idp_templates5_ldap2.idp_id,` +
` projections.idp_templates5_ldap2.servers,` +
` projections.idp_templates5_ldap2.start_tls,` +
` projections.idp_templates5_ldap2.base_dn,` +
` projections.idp_templates5_ldap2.bind_dn,` +
` projections.idp_templates5_ldap2.bind_password,` +
` projections.idp_templates5_ldap2.user_base,` +
` projections.idp_templates5_ldap2.user_object_classes,` +
` projections.idp_templates5_ldap2.user_filters,` +
` projections.idp_templates5_ldap2.timeout,` +
` projections.idp_templates5_ldap2.id_attribute,` +
` projections.idp_templates5_ldap2.first_name_attribute,` +
` projections.idp_templates5_ldap2.last_name_attribute,` +
` projections.idp_templates5_ldap2.display_name_attribute,` +
` projections.idp_templates5_ldap2.nick_name_attribute,` +
` projections.idp_templates5_ldap2.preferred_username_attribute,` +
` projections.idp_templates5_ldap2.email_attribute,` +
` projections.idp_templates5_ldap2.email_verified,` +
` projections.idp_templates5_ldap2.phone_attribute,` +
` projections.idp_templates5_ldap2.phone_verified_attribute,` +
` projections.idp_templates5_ldap2.preferred_language_attribute,` +
` projections.idp_templates5_ldap2.avatar_url_attribute,` +
` projections.idp_templates5_ldap2.profile_attribute` +
` FROM projections.idp_templates5` +
` LEFT JOIN projections.idp_templates5_oauth2 ON projections.idp_templates5.id = projections.idp_templates5_oauth2.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_oauth2.instance_id` +
` LEFT JOIN projections.idp_templates5_oidc ON projections.idp_templates5.id = projections.idp_templates5_oidc.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_oidc.instance_id` +
` LEFT JOIN projections.idp_templates5_jwt ON projections.idp_templates5.id = projections.idp_templates5_jwt.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_jwt.instance_id` +
` LEFT JOIN projections.idp_templates5_azure ON projections.idp_templates5.id = projections.idp_templates5_azure.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_azure.instance_id` +
` LEFT JOIN projections.idp_templates5_github ON projections.idp_templates5.id = projections.idp_templates5_github.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_github.instance_id` +
` LEFT JOIN projections.idp_templates5_github_enterprise ON projections.idp_templates5.id = projections.idp_templates5_github_enterprise.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_github_enterprise.instance_id` +
` LEFT JOIN projections.idp_templates5_gitlab ON projections.idp_templates5.id = projections.idp_templates5_gitlab.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_gitlab.instance_id` +
` LEFT JOIN projections.idp_templates5_gitlab_self_hosted ON projections.idp_templates5.id = projections.idp_templates5_gitlab_self_hosted.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_gitlab_self_hosted.instance_id` +
` LEFT JOIN projections.idp_templates5_google ON projections.idp_templates5.id = projections.idp_templates5_google.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_google.instance_id` +
` LEFT JOIN projections.idp_templates5_ldap2 ON projections.idp_templates5.id = projections.idp_templates5_ldap2.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_ldap2.instance_id` +
` AS OF SYSTEM TIME '-1 ms'`
idpTemplateCols = []string{
"id",
@ -220,113 +220,113 @@ var (
"avatar_url_attribute",
"profile_attribute",
}
idpTemplatesQuery = `SELECT projections.idp_templates4.id,` +
` projections.idp_templates4.resource_owner,` +
` projections.idp_templates4.creation_date,` +
` projections.idp_templates4.change_date,` +
` projections.idp_templates4.sequence,` +
` projections.idp_templates4.state,` +
` projections.idp_templates4.name,` +
` projections.idp_templates4.type,` +
` projections.idp_templates4.owner_type,` +
` projections.idp_templates4.is_creation_allowed,` +
` projections.idp_templates4.is_linking_allowed,` +
` projections.idp_templates4.is_auto_creation,` +
` projections.idp_templates4.is_auto_update,` +
idpTemplatesQuery = `SELECT projections.idp_templates5.id,` +
` projections.idp_templates5.resource_owner,` +
` projections.idp_templates5.creation_date,` +
` projections.idp_templates5.change_date,` +
` projections.idp_templates5.sequence,` +
` projections.idp_templates5.state,` +
` projections.idp_templates5.name,` +
` projections.idp_templates5.type,` +
` projections.idp_templates5.owner_type,` +
` projections.idp_templates5.is_creation_allowed,` +
` projections.idp_templates5.is_linking_allowed,` +
` projections.idp_templates5.is_auto_creation,` +
` projections.idp_templates5.is_auto_update,` +
// oauth
` projections.idp_templates4_oauth2.idp_id,` +
` projections.idp_templates4_oauth2.client_id,` +
` projections.idp_templates4_oauth2.client_secret,` +
` projections.idp_templates4_oauth2.authorization_endpoint,` +
` projections.idp_templates4_oauth2.token_endpoint,` +
` projections.idp_templates4_oauth2.user_endpoint,` +
` projections.idp_templates4_oauth2.scopes,` +
` projections.idp_templates4_oauth2.id_attribute,` +
` projections.idp_templates5_oauth2.idp_id,` +
` projections.idp_templates5_oauth2.client_id,` +
` projections.idp_templates5_oauth2.client_secret,` +
` projections.idp_templates5_oauth2.authorization_endpoint,` +
` projections.idp_templates5_oauth2.token_endpoint,` +
` projections.idp_templates5_oauth2.user_endpoint,` +
` projections.idp_templates5_oauth2.scopes,` +
` projections.idp_templates5_oauth2.id_attribute,` +
// oidc
` projections.idp_templates4_oidc.idp_id,` +
` projections.idp_templates4_oidc.issuer,` +
` projections.idp_templates4_oidc.client_id,` +
` projections.idp_templates4_oidc.client_secret,` +
` projections.idp_templates4_oidc.scopes,` +
` projections.idp_templates4_oidc.id_token_mapping,` +
` projections.idp_templates5_oidc.idp_id,` +
` projections.idp_templates5_oidc.issuer,` +
` projections.idp_templates5_oidc.client_id,` +
` projections.idp_templates5_oidc.client_secret,` +
` projections.idp_templates5_oidc.scopes,` +
` projections.idp_templates5_oidc.id_token_mapping,` +
// jwt
` projections.idp_templates4_jwt.idp_id,` +
` projections.idp_templates4_jwt.issuer,` +
` projections.idp_templates4_jwt.jwt_endpoint,` +
` projections.idp_templates4_jwt.keys_endpoint,` +
` projections.idp_templates4_jwt.header_name,` +
` projections.idp_templates5_jwt.idp_id,` +
` projections.idp_templates5_jwt.issuer,` +
` projections.idp_templates5_jwt.jwt_endpoint,` +
` projections.idp_templates5_jwt.keys_endpoint,` +
` projections.idp_templates5_jwt.header_name,` +
// azure
` projections.idp_templates4_azure.idp_id,` +
` projections.idp_templates4_azure.client_id,` +
` projections.idp_templates4_azure.client_secret,` +
` projections.idp_templates4_azure.scopes,` +
` projections.idp_templates4_azure.tenant,` +
` projections.idp_templates4_azure.is_email_verified,` +
` projections.idp_templates5_azure.idp_id,` +
` projections.idp_templates5_azure.client_id,` +
` projections.idp_templates5_azure.client_secret,` +
` projections.idp_templates5_azure.scopes,` +
` projections.idp_templates5_azure.tenant,` +
` projections.idp_templates5_azure.is_email_verified,` +
// github
` projections.idp_templates4_github.idp_id,` +
` projections.idp_templates4_github.client_id,` +
` projections.idp_templates4_github.client_secret,` +
` projections.idp_templates4_github.scopes,` +
` projections.idp_templates5_github.idp_id,` +
` projections.idp_templates5_github.client_id,` +
` projections.idp_templates5_github.client_secret,` +
` projections.idp_templates5_github.scopes,` +
// github enterprise
` projections.idp_templates4_github_enterprise.idp_id,` +
` projections.idp_templates4_github_enterprise.client_id,` +
` projections.idp_templates4_github_enterprise.client_secret,` +
` projections.idp_templates4_github_enterprise.authorization_endpoint,` +
` projections.idp_templates4_github_enterprise.token_endpoint,` +
` projections.idp_templates4_github_enterprise.user_endpoint,` +
` projections.idp_templates4_github_enterprise.scopes,` +
` projections.idp_templates5_github_enterprise.idp_id,` +
` projections.idp_templates5_github_enterprise.client_id,` +
` projections.idp_templates5_github_enterprise.client_secret,` +
` projections.idp_templates5_github_enterprise.authorization_endpoint,` +
` projections.idp_templates5_github_enterprise.token_endpoint,` +
` projections.idp_templates5_github_enterprise.user_endpoint,` +
` projections.idp_templates5_github_enterprise.scopes,` +
// gitlab
` projections.idp_templates4_gitlab.idp_id,` +
` projections.idp_templates4_gitlab.client_id,` +
` projections.idp_templates4_gitlab.client_secret,` +
` projections.idp_templates4_gitlab.scopes,` +
` projections.idp_templates5_gitlab.idp_id,` +
` projections.idp_templates5_gitlab.client_id,` +
` projections.idp_templates5_gitlab.client_secret,` +
` projections.idp_templates5_gitlab.scopes,` +
// gitlab self hosted
` projections.idp_templates4_gitlab_self_hosted.idp_id,` +
` projections.idp_templates4_gitlab_self_hosted.issuer,` +
` projections.idp_templates4_gitlab_self_hosted.client_id,` +
` projections.idp_templates4_gitlab_self_hosted.client_secret,` +
` projections.idp_templates4_gitlab_self_hosted.scopes,` +
` projections.idp_templates5_gitlab_self_hosted.idp_id,` +
` projections.idp_templates5_gitlab_self_hosted.issuer,` +
` projections.idp_templates5_gitlab_self_hosted.client_id,` +
` projections.idp_templates5_gitlab_self_hosted.client_secret,` +
` projections.idp_templates5_gitlab_self_hosted.scopes,` +
// google
` projections.idp_templates4_google.idp_id,` +
` projections.idp_templates4_google.client_id,` +
` projections.idp_templates4_google.client_secret,` +
` projections.idp_templates4_google.scopes,` +
` projections.idp_templates5_google.idp_id,` +
` projections.idp_templates5_google.client_id,` +
` projections.idp_templates5_google.client_secret,` +
` projections.idp_templates5_google.scopes,` +
// ldap
` projections.idp_templates4_ldap2.idp_id,` +
` projections.idp_templates4_ldap2.servers,` +
` projections.idp_templates4_ldap2.start_tls,` +
` projections.idp_templates4_ldap2.base_dn,` +
` projections.idp_templates4_ldap2.bind_dn,` +
` projections.idp_templates4_ldap2.bind_password,` +
` projections.idp_templates4_ldap2.user_base,` +
` projections.idp_templates4_ldap2.user_object_classes,` +
` projections.idp_templates4_ldap2.user_filters,` +
` projections.idp_templates4_ldap2.timeout,` +
` projections.idp_templates4_ldap2.id_attribute,` +
` projections.idp_templates4_ldap2.first_name_attribute,` +
` projections.idp_templates4_ldap2.last_name_attribute,` +
` projections.idp_templates4_ldap2.display_name_attribute,` +
` projections.idp_templates4_ldap2.nick_name_attribute,` +
` projections.idp_templates4_ldap2.preferred_username_attribute,` +
` projections.idp_templates4_ldap2.email_attribute,` +
` projections.idp_templates4_ldap2.email_verified,` +
` projections.idp_templates4_ldap2.phone_attribute,` +
` projections.idp_templates4_ldap2.phone_verified_attribute,` +
` projections.idp_templates4_ldap2.preferred_language_attribute,` +
` projections.idp_templates4_ldap2.avatar_url_attribute,` +
` projections.idp_templates4_ldap2.profile_attribute,` +
` projections.idp_templates5_ldap2.idp_id,` +
` projections.idp_templates5_ldap2.servers,` +
` projections.idp_templates5_ldap2.start_tls,` +
` projections.idp_templates5_ldap2.base_dn,` +
` projections.idp_templates5_ldap2.bind_dn,` +
` projections.idp_templates5_ldap2.bind_password,` +
` projections.idp_templates5_ldap2.user_base,` +
` projections.idp_templates5_ldap2.user_object_classes,` +
` projections.idp_templates5_ldap2.user_filters,` +
` projections.idp_templates5_ldap2.timeout,` +
` projections.idp_templates5_ldap2.id_attribute,` +
` projections.idp_templates5_ldap2.first_name_attribute,` +
` projections.idp_templates5_ldap2.last_name_attribute,` +
` projections.idp_templates5_ldap2.display_name_attribute,` +
` projections.idp_templates5_ldap2.nick_name_attribute,` +
` projections.idp_templates5_ldap2.preferred_username_attribute,` +
` projections.idp_templates5_ldap2.email_attribute,` +
` projections.idp_templates5_ldap2.email_verified,` +
` projections.idp_templates5_ldap2.phone_attribute,` +
` projections.idp_templates5_ldap2.phone_verified_attribute,` +
` projections.idp_templates5_ldap2.preferred_language_attribute,` +
` projections.idp_templates5_ldap2.avatar_url_attribute,` +
` projections.idp_templates5_ldap2.profile_attribute,` +
` COUNT(*) OVER ()` +
` FROM projections.idp_templates4` +
` LEFT JOIN projections.idp_templates4_oauth2 ON projections.idp_templates4.id = projections.idp_templates4_oauth2.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_oauth2.instance_id` +
` LEFT JOIN projections.idp_templates4_oidc ON projections.idp_templates4.id = projections.idp_templates4_oidc.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_oidc.instance_id` +
` LEFT JOIN projections.idp_templates4_jwt ON projections.idp_templates4.id = projections.idp_templates4_jwt.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_jwt.instance_id` +
` LEFT JOIN projections.idp_templates4_azure ON projections.idp_templates4.id = projections.idp_templates4_azure.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_azure.instance_id` +
` LEFT JOIN projections.idp_templates4_github ON projections.idp_templates4.id = projections.idp_templates4_github.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_github.instance_id` +
` LEFT JOIN projections.idp_templates4_github_enterprise ON projections.idp_templates4.id = projections.idp_templates4_github_enterprise.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_github_enterprise.instance_id` +
` LEFT JOIN projections.idp_templates4_gitlab ON projections.idp_templates4.id = projections.idp_templates4_gitlab.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_gitlab.instance_id` +
` LEFT JOIN projections.idp_templates4_gitlab_self_hosted ON projections.idp_templates4.id = projections.idp_templates4_gitlab_self_hosted.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_gitlab_self_hosted.instance_id` +
` LEFT JOIN projections.idp_templates4_google ON projections.idp_templates4.id = projections.idp_templates4_google.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_google.instance_id` +
` LEFT JOIN projections.idp_templates4_ldap2 ON projections.idp_templates4.id = projections.idp_templates4_ldap2.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_ldap2.instance_id` +
` FROM projections.idp_templates5` +
` LEFT JOIN projections.idp_templates5_oauth2 ON projections.idp_templates5.id = projections.idp_templates5_oauth2.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_oauth2.instance_id` +
` LEFT JOIN projections.idp_templates5_oidc ON projections.idp_templates5.id = projections.idp_templates5_oidc.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_oidc.instance_id` +
` LEFT JOIN projections.idp_templates5_jwt ON projections.idp_templates5.id = projections.idp_templates5_jwt.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_jwt.instance_id` +
` LEFT JOIN projections.idp_templates5_azure ON projections.idp_templates5.id = projections.idp_templates5_azure.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_azure.instance_id` +
` LEFT JOIN projections.idp_templates5_github ON projections.idp_templates5.id = projections.idp_templates5_github.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_github.instance_id` +
` LEFT JOIN projections.idp_templates5_github_enterprise ON projections.idp_templates5.id = projections.idp_templates5_github_enterprise.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_github_enterprise.instance_id` +
` LEFT JOIN projections.idp_templates5_gitlab ON projections.idp_templates5.id = projections.idp_templates5_gitlab.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_gitlab.instance_id` +
` LEFT JOIN projections.idp_templates5_gitlab_self_hosted ON projections.idp_templates5.id = projections.idp_templates5_gitlab_self_hosted.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_gitlab_self_hosted.instance_id` +
` LEFT JOIN projections.idp_templates5_google ON projections.idp_templates5.id = projections.idp_templates5_google.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_google.instance_id` +
` LEFT JOIN projections.idp_templates5_ldap2 ON projections.idp_templates5.id = projections.idp_templates5_ldap2.idp_id AND projections.idp_templates5.instance_id = projections.idp_templates5_ldap2.instance_id` +
` AS OF SYSTEM TIME '-1 ms'`
idpTemplatesCols = []string{
"id",

View File

@ -14,14 +14,14 @@ import (
var (
idpUserLinksQuery = regexp.QuoteMeta(`SELECT projections.idp_user_links3.idp_id,` +
` projections.idp_user_links3.user_id,` +
` projections.idp_templates4.name,` +
` projections.idp_templates5.name,` +
` projections.idp_user_links3.external_user_id,` +
` projections.idp_user_links3.display_name,` +
` projections.idp_templates4.type,` +
` projections.idp_templates5.type,` +
` projections.idp_user_links3.resource_owner,` +
` COUNT(*) OVER ()` +
` FROM projections.idp_user_links3` +
` LEFT JOIN projections.idp_templates4 ON projections.idp_user_links3.idp_id = projections.idp_templates4.id AND projections.idp_user_links3.instance_id = projections.idp_templates4.instance_id` +
` LEFT JOIN projections.idp_templates5 ON projections.idp_user_links3.idp_id = projections.idp_templates5.id AND projections.idp_user_links3.instance_id = projections.idp_templates5.instance_id` +
` AS OF SYSTEM TIME '-1 ms'`)
idpUserLinksCols = []string{
"idp_id",

View File

@ -17,7 +17,7 @@ import (
)
const (
IDPTemplateTable = "projections.idp_templates4"
IDPTemplateTable = "projections.idp_templates5"
IDPTemplateOAuthTable = IDPTemplateTable + "_" + IDPTemplateOAuthSuffix
IDPTemplateOIDCTable = IDPTemplateTable + "_" + IDPTemplateOIDCSuffix
IDPTemplateJWTTable = IDPTemplateTable + "_" + IDPTemplateJWTSuffix
@ -435,6 +435,10 @@ func (p *idpTemplateProjection) reducers() []handler.AggregateReducer {
Event: instance.LDAPIDPChangedEventType,
Reduce: p.reduceLDAPIDPChanged,
},
{
Event: instance.IDPConfigRemovedEventType,
Reduce: p.reduceIDPConfigRemoved,
},
{
Event: instance.IDPRemovedEventType,
Reduce: p.reduceIDPRemoved,
@ -552,6 +556,10 @@ func (p *idpTemplateProjection) reducers() []handler.AggregateReducer {
Event: org.LDAPIDPChangedEventType,
Reduce: p.reduceLDAPIDPChanged,
},
{
Event: org.IDPConfigRemovedEventType,
Reduce: p.reduceIDPConfigRemoved,
},
{
Event: org.IDPRemovedEventType,
Reduce: p.reduceIDPRemoved,
@ -1734,6 +1742,25 @@ func (p *idpTemplateProjection) reduceLDAPIDPChanged(event eventstore.Event) (*h
ops...,
), nil
}
func (p *idpTemplateProjection) reduceIDPConfigRemoved(event eventstore.Event) (*handler.Statement, error) {
var idpEvent idpconfig.IDPConfigRemovedEvent
switch e := event.(type) {
case *org.IDPConfigRemovedEvent:
idpEvent = e.IDPConfigRemovedEvent
case *instance.IDPConfigRemovedEvent:
idpEvent = e.IDPConfigRemovedEvent
default:
return nil, errors.ThrowInvalidArgumentf(nil, "HANDL-SAFet", "reduce.wrong.event.type %v", []eventstore.EventType{org.IDPConfigRemovedEventType, instance.IDPConfigRemovedEventType})
}
return crdb.NewDeleteStatement(
&idpEvent,
[]handler.Condition{
handler.NewCond(IDPTemplateIDCol, idpEvent.ConfigID),
handler.NewCond(IDPTemplateInstanceIDCol, idpEvent.Aggregate().InstanceID),
},
), nil
}
func (p *idpTemplateProjection) reduceIDPRemoved(event eventstore.Event) (*handler.Statement, error) {
var idpEvent idp.RemovedEvent

View File

@ -15,11 +15,11 @@ import (
)
var (
idpTemplateInsertStmt = `INSERT INTO projections.idp_templates4` +
idpTemplateInsertStmt = `INSERT INTO projections.idp_templates5` +
` (id, creation_date, change_date, sequence, resource_owner, instance_id, state, name, owner_type, type, is_creation_allowed, is_linking_allowed, is_auto_creation, is_auto_update)` +
` VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)`
idpTemplateUpdateMinimalStmt = `UPDATE projections.idp_templates4 SET (is_creation_allowed, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)`
idpTemplateUpdateStmt = `UPDATE projections.idp_templates4 SET (name, is_creation_allowed, is_linking_allowed, is_auto_creation, is_auto_update, change_date, sequence)` +
idpTemplateUpdateMinimalStmt = `UPDATE projections.idp_templates5 SET (is_creation_allowed, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)`
idpTemplateUpdateStmt = `UPDATE projections.idp_templates5 SET (name, is_creation_allowed, is_linking_allowed, is_auto_creation, is_auto_update, change_date, sequence)` +
` = ($1, $2, $3, $4, $5, $6, $7) WHERE (id = $8) AND (instance_id = $9)`
)
@ -51,7 +51,7 @@ func TestIDPTemplateProjection_reducesRemove(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.idp_templates4 WHERE (instance_id = $1)",
expectedStmt: "DELETE FROM projections.idp_templates5 WHERE (instance_id = $1)",
expectedArgs: []interface{}{
"agg-id",
},
@ -77,7 +77,7 @@ func TestIDPTemplateProjection_reducesRemove(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence, owner_removed) = ($1, $2, $3) WHERE (instance_id = $4) AND (resource_owner = $5)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence, owner_removed) = ($1, $2, $3) WHERE (instance_id = $4) AND (resource_owner = $5)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -109,7 +109,36 @@ func TestIDPTemplateProjection_reducesRemove(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.idp_templates4 WHERE (id = $1) AND (instance_id = $2)",
expectedStmt: "DELETE FROM projections.idp_templates5 WHERE (id = $1) AND (instance_id = $2)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
},
},
},
},
},
},
{
name: "org reduceIDPConfigRemoved",
reduce: (&idpTemplateProjection{}).reduceIDPConfigRemoved,
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPConfigRemovedEventType),
org.AggregateType,
[]byte(`{
"idpConfigId": "idp-id"
}`),
), org.IDPConfigRemovedEventMapper),
},
want: wantReduce{
aggregateType: eventstore.AggregateType("org"),
sequence: 15,
previousSequence: 10,
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.idp_templates5 WHERE (id = $1) AND (instance_id = $2)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -199,7 +228,7 @@ func TestIDPTemplateProjection_reducesOAuth(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_oauth2 (idp_id, instance_id, client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes, id_attribute) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedStmt: "INSERT INTO projections.idp_templates5_oauth2 (idp_id, instance_id, client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes, id_attribute) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -270,7 +299,7 @@ func TestIDPTemplateProjection_reducesOAuth(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_oauth2 (idp_id, instance_id, client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes, id_attribute) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedStmt: "INSERT INTO projections.idp_templates5_oauth2 (idp_id, instance_id, client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes, id_attribute) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -318,7 +347,7 @@ func TestIDPTemplateProjection_reducesOAuth(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_oauth2 SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_oauth2 SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"id",
"idp-id",
@ -378,7 +407,7 @@ func TestIDPTemplateProjection_reducesOAuth(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_oauth2 SET (client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes, id_attribute) = ($1, $2, $3, $4, $5, $6, $7) WHERE (idp_id = $8) AND (instance_id = $9)",
expectedStmt: "UPDATE projections.idp_templates5_oauth2 SET (client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes, id_attribute) = ($1, $2, $3, $4, $5, $6, $7) WHERE (idp_id = $8) AND (instance_id = $9)",
expectedArgs: []interface{}{
"client_id",
anyArg{},
@ -466,7 +495,7 @@ func TestIDPTemplateProjection_reducesAzureAD(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_azure (idp_id, instance_id, client_id, client_secret, scopes, tenant, is_email_verified) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedStmt: "INSERT INTO projections.idp_templates5_azure (idp_id, instance_id, client_id, client_secret, scopes, tenant, is_email_verified) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -533,7 +562,7 @@ func TestIDPTemplateProjection_reducesAzureAD(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_azure (idp_id, instance_id, client_id, client_secret, scopes, tenant, is_email_verified) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedStmt: "INSERT INTO projections.idp_templates5_azure (idp_id, instance_id, client_id, client_secret, scopes, tenant, is_email_verified) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -600,7 +629,7 @@ func TestIDPTemplateProjection_reducesAzureAD(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_azure (idp_id, instance_id, client_id, client_secret, scopes, tenant, is_email_verified) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedStmt: "INSERT INTO projections.idp_templates5_azure (idp_id, instance_id, client_id, client_secret, scopes, tenant, is_email_verified) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -646,7 +675,7 @@ func TestIDPTemplateProjection_reducesAzureAD(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_azure SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_azure SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"id",
"idp-id",
@ -704,7 +733,7 @@ func TestIDPTemplateProjection_reducesAzureAD(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_azure SET (client_id, client_secret, scopes, tenant, is_email_verified) = ($1, $2, $3, $4, $5) WHERE (idp_id = $6) AND (instance_id = $7)",
expectedStmt: "UPDATE projections.idp_templates5_azure SET (client_id, client_secret, scopes, tenant, is_email_verified) = ($1, $2, $3, $4, $5) WHERE (idp_id = $6) AND (instance_id = $7)",
expectedArgs: []interface{}{
"client_id",
anyArg{},
@ -795,7 +824,7 @@ func TestIDPTemplateProjection_reducesGitHub(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_github (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedStmt: "INSERT INTO projections.idp_templates5_github (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -858,7 +887,7 @@ func TestIDPTemplateProjection_reducesGitHub(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_github (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedStmt: "INSERT INTO projections.idp_templates5_github (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -902,7 +931,7 @@ func TestIDPTemplateProjection_reducesGitHub(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_github SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_github SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"id",
"idp-id",
@ -958,7 +987,7 @@ func TestIDPTemplateProjection_reducesGitHub(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_github SET (client_id, client_secret, scopes) = ($1, $2, $3) WHERE (idp_id = $4) AND (instance_id = $5)",
expectedStmt: "UPDATE projections.idp_templates5_github SET (client_id, client_secret, scopes) = ($1, $2, $3) WHERE (idp_id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{
"client_id",
anyArg{},
@ -1050,7 +1079,7 @@ func TestIDPTemplateProjection_reducesGitHubEnterprise(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_github_enterprise (idp_id, instance_id, client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
expectedStmt: "INSERT INTO projections.idp_templates5_github_enterprise (idp_id, instance_id, client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -1119,7 +1148,7 @@ func TestIDPTemplateProjection_reducesGitHubEnterprise(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_github_enterprise (idp_id, instance_id, client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
expectedStmt: "INSERT INTO projections.idp_templates5_github_enterprise (idp_id, instance_id, client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -1166,7 +1195,7 @@ func TestIDPTemplateProjection_reducesGitHubEnterprise(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_github_enterprise SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_github_enterprise SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"id",
"idp-id",
@ -1225,7 +1254,7 @@ func TestIDPTemplateProjection_reducesGitHubEnterprise(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_github_enterprise SET (client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes) = ($1, $2, $3, $4, $5, $6) WHERE (idp_id = $7) AND (instance_id = $8)",
expectedStmt: "UPDATE projections.idp_templates5_github_enterprise SET (client_id, client_secret, authorization_endpoint, token_endpoint, user_endpoint, scopes) = ($1, $2, $3, $4, $5, $6) WHERE (idp_id = $7) AND (instance_id = $8)",
expectedArgs: []interface{}{
"client_id",
anyArg{},
@ -1316,7 +1345,7 @@ func TestIDPTemplateProjection_reducesGitLab(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_gitlab (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedStmt: "INSERT INTO projections.idp_templates5_gitlab (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -1378,7 +1407,7 @@ func TestIDPTemplateProjection_reducesGitLab(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_gitlab (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedStmt: "INSERT INTO projections.idp_templates5_gitlab (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -1422,7 +1451,7 @@ func TestIDPTemplateProjection_reducesGitLab(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_gitlab SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_gitlab SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"id",
"idp-id",
@ -1478,7 +1507,7 @@ func TestIDPTemplateProjection_reducesGitLab(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_gitlab SET (client_id, client_secret, scopes) = ($1, $2, $3) WHERE (idp_id = $4) AND (instance_id = $5)",
expectedStmt: "UPDATE projections.idp_templates5_gitlab SET (client_id, client_secret, scopes) = ($1, $2, $3) WHERE (idp_id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{
"client_id",
anyArg{},
@ -1568,7 +1597,7 @@ func TestIDPTemplateProjection_reducesGitLabSelfHosted(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_gitlab_self_hosted (idp_id, instance_id, issuer, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5, $6)",
expectedStmt: "INSERT INTO projections.idp_templates5_gitlab_self_hosted (idp_id, instance_id, issuer, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5, $6)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -1633,7 +1662,7 @@ func TestIDPTemplateProjection_reducesGitLabSelfHosted(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_gitlab_self_hosted (idp_id, instance_id, issuer, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5, $6)",
expectedStmt: "INSERT INTO projections.idp_templates5_gitlab_self_hosted (idp_id, instance_id, issuer, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5, $6)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -1678,7 +1707,7 @@ func TestIDPTemplateProjection_reducesGitLabSelfHosted(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_gitlab_self_hosted SET issuer = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_gitlab_self_hosted SET issuer = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"issuer",
"idp-id",
@ -1735,7 +1764,7 @@ func TestIDPTemplateProjection_reducesGitLabSelfHosted(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_gitlab_self_hosted SET (issuer, client_id, client_secret, scopes) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedStmt: "UPDATE projections.idp_templates5_gitlab_self_hosted SET (issuer, client_id, client_secret, scopes) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedArgs: []interface{}{
"issuer",
"client_id",
@ -1824,7 +1853,7 @@ func TestIDPTemplateProjection_reducesGoogle(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_google (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedStmt: "INSERT INTO projections.idp_templates5_google (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -1886,7 +1915,7 @@ func TestIDPTemplateProjection_reducesGoogle(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_google (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedStmt: "INSERT INTO projections.idp_templates5_google (idp_id, instance_id, client_id, client_secret, scopes) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -1930,7 +1959,7 @@ func TestIDPTemplateProjection_reducesGoogle(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_google SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_google SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"id",
"idp-id",
@ -1986,7 +2015,7 @@ func TestIDPTemplateProjection_reducesGoogle(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_google SET (client_id, client_secret, scopes) = ($1, $2, $3) WHERE (idp_id = $4) AND (instance_id = $5)",
expectedStmt: "UPDATE projections.idp_templates5_google SET (client_id, client_secret, scopes) = ($1, $2, $3) WHERE (idp_id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{
"client_id",
anyArg{},
@ -2094,7 +2123,7 @@ func TestIDPTemplateProjection_reducesLDAP(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_ldap2 (idp_id, instance_id, servers, start_tls, base_dn, bind_dn, bind_password, user_base, user_object_classes, user_filters, timeout, id_attribute, first_name_attribute, last_name_attribute, display_name_attribute, nick_name_attribute, preferred_username_attribute, email_attribute, email_verified, phone_attribute, phone_verified_attribute, preferred_language_attribute, avatar_url_attribute, profile_attribute) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24)",
expectedStmt: "INSERT INTO projections.idp_templates5_ldap2 (idp_id, instance_id, servers, start_tls, base_dn, bind_dn, bind_password, user_base, user_object_classes, user_filters, timeout, id_attribute, first_name_attribute, last_name_attribute, display_name_attribute, nick_name_attribute, preferred_username_attribute, email_attribute, email_verified, phone_attribute, phone_verified_attribute, preferred_language_attribute, avatar_url_attribute, profile_attribute) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -2195,7 +2224,7 @@ func TestIDPTemplateProjection_reducesLDAP(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_ldap2 (idp_id, instance_id, servers, start_tls, base_dn, bind_dn, bind_password, user_base, user_object_classes, user_filters, timeout, id_attribute, first_name_attribute, last_name_attribute, display_name_attribute, nick_name_attribute, preferred_username_attribute, email_attribute, email_verified, phone_attribute, phone_verified_attribute, preferred_language_attribute, avatar_url_attribute, profile_attribute) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24)",
expectedStmt: "INSERT INTO projections.idp_templates5_ldap2 (idp_id, instance_id, servers, start_tls, base_dn, bind_dn, bind_password, user_base, user_object_classes, user_filters, timeout, id_attribute, first_name_attribute, last_name_attribute, display_name_attribute, nick_name_attribute, preferred_username_attribute, email_attribute, email_verified, phone_attribute, phone_verified_attribute, preferred_language_attribute, avatar_url_attribute, profile_attribute) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -2248,7 +2277,7 @@ func TestIDPTemplateProjection_reducesLDAP(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (name, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedStmt: "UPDATE projections.idp_templates5 SET (name, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{
"custom-zitadel-instance",
anyArg{},
@ -2258,7 +2287,7 @@ func TestIDPTemplateProjection_reducesLDAP(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_ldap2 SET base_dn = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_ldap2 SET base_dn = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"basedn",
"idp-id",
@ -2333,7 +2362,7 @@ func TestIDPTemplateProjection_reducesLDAP(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_ldap2 SET (servers, start_tls, base_dn, bind_dn, bind_password, user_base, user_object_classes, user_filters, timeout, id_attribute, first_name_attribute, last_name_attribute, display_name_attribute, nick_name_attribute, preferred_username_attribute, email_attribute, email_verified, phone_attribute, phone_verified_attribute, preferred_language_attribute, avatar_url_attribute, profile_attribute) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22) WHERE (idp_id = $23) AND (instance_id = $24)",
expectedStmt: "UPDATE projections.idp_templates5_ldap2 SET (servers, start_tls, base_dn, bind_dn, bind_password, user_base, user_object_classes, user_filters, timeout, id_attribute, first_name_attribute, last_name_attribute, display_name_attribute, nick_name_attribute, preferred_username_attribute, email_attribute, email_verified, phone_attribute, phone_verified_attribute, preferred_language_attribute, avatar_url_attribute, profile_attribute) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22) WHERE (idp_id = $23) AND (instance_id = $24)",
expectedArgs: []interface{}{
database.StringArray{"server"},
false,
@ -2382,7 +2411,7 @@ func TestIDPTemplateProjection_reducesLDAP(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence, owner_removed) = ($1, $2, $3) WHERE (instance_id = $4) AND (resource_owner = $5)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence, owner_removed) = ($1, $2, $3) WHERE (instance_id = $4) AND (resource_owner = $5)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -2472,7 +2501,7 @@ func TestIDPTemplateProjection_reducesOIDC(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_oidc (idp_id, instance_id, issuer, client_id, client_secret, scopes, id_token_mapping) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedStmt: "INSERT INTO projections.idp_templates5_oidc (idp_id, instance_id, issuer, client_id, client_secret, scopes, id_token_mapping) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -2538,7 +2567,7 @@ func TestIDPTemplateProjection_reducesOIDC(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_oidc (idp_id, instance_id, issuer, client_id, client_secret, scopes, id_token_mapping) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedStmt: "INSERT INTO projections.idp_templates5_oidc (idp_id, instance_id, issuer, client_id, client_secret, scopes, id_token_mapping) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -2584,7 +2613,7 @@ func TestIDPTemplateProjection_reducesOIDC(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_oidc SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_oidc SET client_id = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"id",
"idp-id",
@ -2642,7 +2671,7 @@ func TestIDPTemplateProjection_reducesOIDC(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_oidc SET (client_id, client_secret, issuer, scopes, id_token_mapping) = ($1, $2, $3, $4, $5) WHERE (idp_id = $6) AND (instance_id = $7)",
expectedStmt: "UPDATE projections.idp_templates5_oidc SET (client_id, client_secret, issuer, scopes, id_token_mapping) = ($1, $2, $3, $4, $5) WHERE (idp_id = $6) AND (instance_id = $7)",
expectedArgs: []interface{}{
"client_id",
anyArg{},
@ -2795,7 +2824,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (name, is_auto_creation, change_date, sequence) = ($1, $2, $3, $4) WHERE (id = $5) AND (instance_id = $6)",
expectedStmt: "UPDATE projections.idp_templates5 SET (name, is_auto_creation, change_date, sequence) = ($1, $2, $3, $4) WHERE (id = $5) AND (instance_id = $6)",
expectedArgs: []interface{}{
"custom-zitadel-instance",
true,
@ -2831,7 +2860,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (name, is_auto_creation, change_date, sequence) = ($1, $2, $3, $4) WHERE (id = $5) AND (instance_id = $6)",
expectedStmt: "UPDATE projections.idp_templates5 SET (name, is_auto_creation, change_date, sequence) = ($1, $2, $3, $4) WHERE (id = $5) AND (instance_id = $6)",
expectedArgs: []interface{}{
"custom-zitadel-instance",
true,
@ -2874,7 +2903,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence, type) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence, type) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -2884,7 +2913,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_oidc (idp_id, instance_id, issuer, client_id, client_secret, scopes, id_token_mapping) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedStmt: "INSERT INTO projections.idp_templates5_oidc (idp_id, instance_id, issuer, client_id, client_secret, scopes, id_token_mapping) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedArgs: []interface{}{
"idp-config-id",
"instance-id",
@ -2928,7 +2957,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence, type) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence, type) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -2938,7 +2967,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_oidc (idp_id, instance_id, issuer, client_id, client_secret, scopes, id_token_mapping) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedStmt: "INSERT INTO projections.idp_templates5_oidc (idp_id, instance_id, issuer, client_id, client_secret, scopes, id_token_mapping) VALUES ($1, $2, $3, $4, $5, $6, $7)",
expectedArgs: []interface{}{
"idp-config-id",
"instance-id",
@ -2982,7 +3011,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -2991,7 +3020,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_oidc SET (client_id, client_secret, issuer, scopes) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedStmt: "UPDATE projections.idp_templates5_oidc SET (client_id, client_secret, issuer, scopes) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedArgs: []interface{}{
"client-id",
anyArg{},
@ -3034,7 +3063,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -3043,7 +3072,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_oidc SET (client_id, client_secret, issuer, scopes) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedStmt: "UPDATE projections.idp_templates5_oidc SET (client_id, client_secret, issuer, scopes) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedArgs: []interface{}{
"client-id",
anyArg{},
@ -3080,7 +3109,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence, type) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence, type) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -3090,7 +3119,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_jwt (idp_id, instance_id, issuer, jwt_endpoint, keys_endpoint, header_name) VALUES ($1, $2, $3, $4, $5, $6)",
expectedStmt: "INSERT INTO projections.idp_templates5_jwt (idp_id, instance_id, issuer, jwt_endpoint, keys_endpoint, header_name) VALUES ($1, $2, $3, $4, $5, $6)",
expectedArgs: []interface{}{
"idp-config-id",
"instance-id",
@ -3128,7 +3157,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence, type) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence, type) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -3138,7 +3167,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_jwt (idp_id, instance_id, issuer, jwt_endpoint, keys_endpoint, header_name) VALUES ($1, $2, $3, $4, $5, $6)",
expectedStmt: "INSERT INTO projections.idp_templates5_jwt (idp_id, instance_id, issuer, jwt_endpoint, keys_endpoint, header_name) VALUES ($1, $2, $3, $4, $5, $6)",
expectedArgs: []interface{}{
"idp-config-id",
"instance-id",
@ -3175,7 +3204,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -3184,7 +3213,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_jwt SET (jwt_endpoint, keys_endpoint, header_name, issuer) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedStmt: "UPDATE projections.idp_templates5_jwt SET (jwt_endpoint, keys_endpoint, header_name, issuer) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedArgs: []interface{}{
"https://api.zitadel.ch/jwt",
"https://api.zitadel.ch/keys",
@ -3221,7 +3250,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedStmt: "UPDATE projections.idp_templates5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{
anyArg{},
uint64(15),
@ -3230,7 +3259,7 @@ func TestIDPTemplateProjection_reducesOldConfig(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_jwt SET (jwt_endpoint, keys_endpoint, header_name, issuer) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedStmt: "UPDATE projections.idp_templates5_jwt SET (jwt_endpoint, keys_endpoint, header_name, issuer) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedArgs: []interface{}{
"https://api.zitadel.ch/jwt",
"https://api.zitadel.ch/keys",
@ -3316,7 +3345,7 @@ func TestIDPTemplateProjection_reducesJWT(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_jwt (idp_id, instance_id, issuer, jwt_endpoint, keys_endpoint, header_name) VALUES ($1, $2, $3, $4, $5, $6)",
expectedStmt: "INSERT INTO projections.idp_templates5_jwt (idp_id, instance_id, issuer, jwt_endpoint, keys_endpoint, header_name) VALUES ($1, $2, $3, $4, $5, $6)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -3376,7 +3405,7 @@ func TestIDPTemplateProjection_reducesJWT(t *testing.T) {
},
},
{
expectedStmt: "INSERT INTO projections.idp_templates4_jwt (idp_id, instance_id, issuer, jwt_endpoint, keys_endpoint, header_name) VALUES ($1, $2, $3, $4, $5, $6)",
expectedStmt: "INSERT INTO projections.idp_templates5_jwt (idp_id, instance_id, issuer, jwt_endpoint, keys_endpoint, header_name) VALUES ($1, $2, $3, $4, $5, $6)",
expectedArgs: []interface{}{
"idp-id",
"instance-id",
@ -3421,7 +3450,7 @@ func TestIDPTemplateProjection_reducesJWT(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_jwt SET jwt_endpoint = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedStmt: "UPDATE projections.idp_templates5_jwt SET jwt_endpoint = $1 WHERE (idp_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{
"jwt",
"idp-id",
@ -3459,7 +3488,7 @@ func TestIDPTemplateProjection_reducesJWT(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.idp_templates4 SET (is_creation_allowed, is_linking_allowed, is_auto_creation, is_auto_update, change_date, sequence) = ($1, $2, $3, $4, $5, $6) WHERE (id = $7) AND (instance_id = $8)",
expectedStmt: "UPDATE projections.idp_templates5 SET (is_creation_allowed, is_linking_allowed, is_auto_creation, is_auto_update, change_date, sequence) = ($1, $2, $3, $4, $5, $6) WHERE (id = $7) AND (instance_id = $8)",
expectedArgs: []interface{}{
true,
true,
@ -3472,7 +3501,7 @@ func TestIDPTemplateProjection_reducesJWT(t *testing.T) {
},
},
{
expectedStmt: "UPDATE projections.idp_templates4_jwt SET (jwt_endpoint, keys_endpoint, header_name, issuer) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedStmt: "UPDATE projections.idp_templates5_jwt SET (jwt_endpoint, keys_endpoint, header_name, issuer) = ($1, $2, $3, $4) WHERE (idp_id = $5) AND (instance_id = $6)",
expectedArgs: []interface{}{
"jwt",
"keys",