mirror of
https://github.com/open-metadata/OpenMetadata
synced 2026-05-24 09:39:11 +00:00
* AI #200 - Add TRIGGER permission to application bots * Addressing feedback Co-authored-by: pmbrull <pmbrull@users.noreply.github.com> --------- Co-authored-by: Gitar <noreply@gitar.ai> Co-authored-by: pmbrull <pmbrull@users.noreply.github.com>
45 lines
1.6 KiB
SQL
45 lines
1.6 KiB
SQL
-- Update ApplicationBotRole to include Trigger operation
|
|
UPDATE policy_entity
|
|
SET json = jsonb_set(json::jsonb, '{rules,0,operations}', (json->'rules'->0->'operations')::jsonb || '["Trigger"]'::jsonb)
|
|
WHERE name = 'ApplicationBotPolicy'
|
|
AND json->'rules'->0->'operations' IS NOT NULL
|
|
AND NOT (json->'rules'->0->'operations' @> '"Trigger"'::jsonb);
|
|
|
|
-- Create table for persisted audit log events
|
|
CREATE TABLE IF NOT EXISTS audit_log_event (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
change_event_id UUID NOT NULL,
|
|
event_ts BIGINT NOT NULL,
|
|
event_type VARCHAR(32) NOT NULL,
|
|
user_name VARCHAR(256),
|
|
actor_type VARCHAR(32) DEFAULT 'USER',
|
|
impersonated_by VARCHAR(256) DEFAULT NULL,
|
|
service_name VARCHAR(256) DEFAULT NULL,
|
|
entity_type VARCHAR(128),
|
|
entity_id UUID,
|
|
entity_fqn VARCHAR(768),
|
|
entity_fqn_hash VARCHAR(768),
|
|
event_json TEXT NOT NULL,
|
|
created_at BIGINT DEFAULT (EXTRACT(EPOCH FROM NOW()) * 1000)::BIGINT
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_audit_log_event_change_event_id
|
|
ON audit_log_event (change_event_id);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_audit_log_event_ts
|
|
ON audit_log_event (event_ts DESC);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_audit_log_event_user_ts
|
|
ON audit_log_event (user_name, event_ts DESC);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_audit_log_event_entity_hash_ts
|
|
ON audit_log_event (entity_fqn_hash, event_ts DESC);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_audit_log_actor_type_ts
|
|
ON audit_log_event (actor_type, event_ts DESC);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_audit_log_service_name_ts
|
|
ON audit_log_event (service_name, event_ts DESC);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_audit_log_created_at
|
|
ON audit_log_event (created_at);
|