refactor: relational identity provider table and projection (#11739)

This commit is contained in:
Silvan
2026-03-05 09:43:14 +00:00
committed by GitHub
parent b33c811a01
commit 90faf440f4
9 changed files with 1465 additions and 2522 deletions
@@ -10,13 +10,11 @@ CREATE TABLE zitadel.identity_providers (
, state zitadel.idp_state NOT NULL DEFAULT 'active'
, name TEXT NOT NULL CHECK (name <> '')
, type SMALLINT DEFAULT NULL
, auto_register BOOLEAN NOT NULL DEFAULT TRUE
, allow_creation BOOLEAN NOT NULL DEFAULT TRUE
, allow_auto_creation BOOLEAN NOT NULL DEFAULT TRUE
, allow_auto_update BOOLEAN NOT NULL DEFAULT TRUE
, allow_linking BOOLEAN NOT NULL DEFAULT TRUE
, auto_linking_field SMALLINT DEFAULT NULL
, styling_type SMALLINT
, payload JSONB
, created_at TIMESTAMPTZ NOT NULL DEFAULT now()
@@ -25,8 +23,8 @@ CREATE TABLE zitadel.identity_providers (
, PRIMARY KEY (instance_id, id)
, CONSTRAINT identity_providers_id_unique UNIQUE NULLS NOT DISTINCT (instance_id, org_id, id)
, CONSTRAINT identity_providers_name_unique UNIQUE NULLS NOT DISTINCT (instance_id, org_id, name)
, FOREIGN KEY (instance_id) REFERENCES zitadel.instances(id)
, FOREIGN KEY (instance_id, org_id) REFERENCES zitadel.organizations(instance_id, id)
, FOREIGN KEY (instance_id) REFERENCES zitadel.instances(id) ON DELETE CASCADE
, FOREIGN KEY (instance_id, org_id) REFERENCES zitadel.organizations(instance_id, id) ON DELETE CASCADE
);
-- CREATE INDEX idx_identity_providers_org_id ON identity_providers(instance_id, org_id) WHERE org_id IS NOT NULL;