Skip to content

Commit

Permalink
Add 'identity_zone_id' column to indexes for 'alias_zid' (#2942)
Browse files Browse the repository at this point in the history
* Add Postgres DB migrations for removing old alias_zid indexes and adding new one on aliasZid and identity_zone_id

* Add HSQL DB migrations for removing old alias_zid indexes and adding new one on aliasZid and identity_zone_id

* Add MySQL DB migrations for removing old alias_zid indexes and adding new one on aliasZid and identity_zone_id

* Rework

* Refactorings

- shorten the index name. similar name pattern then existing idexes
- changed order of index. indentity_zone_id should be always first column
- removed not null from SQL, since not needed, see https://stackoverflow.com/questions/8660203/how-to-check-for-is-not-null-and-is-not-empty-string-in-sql-server
or
https://stackoverflow.com/questions/1106258/mysql-null-vs

---------

Co-authored-by: d036670 <markus.strehle@sap.com>
  • Loading branch information
adrianhoelzl-sap and strehle authored Jun 27, 2024
1 parent 1308dde commit 0e522de
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class JdbcIdentityProviderProvisioning implements IdentityProviderProvisi

public static final String IDENTITY_ACTIVE_PROVIDERS_QUERY = IDENTITY_PROVIDERS_QUERY + " and active=?";

public static final String IDP_WITH_ALIAS_EXISTS_QUERY = "select 1 from identity_provider idp where idp.identity_zone_id = ? and idp.alias_zid is not null and idp.alias_zid <> '' limit 1";
public static final String IDP_WITH_ALIAS_EXISTS_QUERY = "select 1 from identity_provider idp where idp.identity_zone_id = ? and idp.alias_zid <> '' limit 1";

public static final String ID_PROVIDER_UPDATE_FIELDS = "version,lastmodified,name,type,config,active,alias_id,alias_zid".replace(",", "=?,") + "=?";

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX IF NOT EXISTS alias_in_zone on identity_provider (identity_zone_id, alias_zid);

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX alias_in_zone on identity_provider (identity_zone_id, alias_zid) LOCK = SHARED;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX CONCURRENTLY IF NOT EXISTS alias_in_zone on identity_provider (identity_zone_id, alias_zid) WHERE alias_zid IS NOT NULL;

0 comments on commit 0e522de

Please sign in to comment.