zitadel/migrations/cockroach/V1.72__actions.sql
Livio Amstutz ed80a8bb1e
feat: actions (#2377)
* feat(actions): begin api

* feat(actions): begin api

* api and projections

* fix: handle multiple statements for a single event in projections

* export func type

* fix test

* update to new reduce interface

* flows in login

* feat: jwt idp

* feat: command side

* feat: add tests

* actions and flows

* fill idp views with jwt idps and return apis

* add jwtEndpoint to jwt idp

* begin jwt request handling

* add feature

* merge

* merge

* handle jwt idp

* cleanup

* bug fixes

* autoregister

* get token from specific header name

* fix: proto

* fixes

* i18n

* begin tests

* fix and log http proxy

* remove docker cache

* fixes

* usergrants in actions api

* tests adn cleanup

* cleanup

* fix add user grant

* set login context

* i18n

Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
2021-09-27 13:43:49 +02:00

64 lines
1.6 KiB
SQL

CREATE TABLE zitadel.projections.actions (
id TEXT,
creation_date TIMESTAMPTZ,
change_date TIMESTAMPTZ,
resource_owner TEXT,
action_state SMALLINT,
sequence BIGINT,
name TEXT,
script TEXT,
timeout BIGINT,
allowed_to_fail BOOLEAN,
PRIMARY KEY (id)
);
CREATE TABLE zitadel.projections.flows_actions (
id TEXT,
creation_date TIMESTAMPTZ,
change_date TIMESTAMPTZ,
resource_owner TEXT,
sequence BIGINT,
name TEXT,
script TEXT,
timeout BIGINT,
allowed_to_fail BOOLEAN,
PRIMARY KEY (id)
);
CREATE TABLE zitadel.projections.flows_triggers (
flow_type SMALLINT,
trigger_type SMALLINT,
resource_owner TEXT,
action_id TEXT,
trigger_sequence SMALLINT,
PRIMARY KEY (flow_type, trigger_type, resource_owner, action_id),
CONSTRAINT fk_action FOREIGN KEY (action_id) REFERENCES zitadel.projections.flows_actions (id) ON DELETE CASCADE
);
CREATE VIEW zitadel.projections.flows_actions_triggers AS (
SELECT a.id AS action_id,
a.name,
a.creation_date,
a.resource_owner,
a.sequence,
a.change_date,
a.script,
a.timeout,
a.allowed_to_fail,
t.flow_type,
t.trigger_type,
t.trigger_sequence
FROM zitadel.projections.flows_triggers t
JOIN zitadel.projections.flows_actions a ON t.action_id = a.id
);
ALTER TABLE auth.features ADD COLUMN actions BOOLEAN;
ALTER TABLE authz.features ADD COLUMN actions BOOLEAN;
ALTER TABLE adminapi.features ADD COLUMN actions BOOLEAN;
ALTER TABLE management.features ADD COLUMN actions BOOLEAN;