# Schema snapshot — generated by schema_snapshot test. # Do not edit by hand. Run with BLESS=1 to regenerate. ## tables table: abandoned_executions id: uuid NOT NULL default=gen_random_uuid() app_id: uuid NOT NULL outbox_id: uuid NOT NULL script_id: uuid NULL inbox_id: uuid NOT NULL status_code: integer NOT NULL result_summary: text NULL created_at: timestamp with time zone NOT NULL default=now() table: admin_sessions token_hash: text NOT NULL user_id: uuid NOT NULL created_at: timestamp with time zone NOT NULL default=now() expires_at: timestamp with time zone NOT NULL last_used_at: timestamp with time zone NOT NULL default=now() table: admin_users id: uuid NOT NULL default=gen_random_uuid() username: text NOT NULL password_hash: text NOT NULL is_active: boolean NOT NULL default=true created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() last_login_at: timestamp with time zone NULL instance_role: text NOT NULL default='owner'::text email: text NULL mfa_secret: text NULL table: api_keys id: uuid NOT NULL default=gen_random_uuid() user_id: uuid NOT NULL hash: text NOT NULL prefix: text NOT NULL name: text NOT NULL scopes: ARRAY NOT NULL app_id: uuid NULL expires_at: timestamp with time zone NULL last_used_at: timestamp with time zone NULL created_at: timestamp with time zone NOT NULL default=now() table: app_domains id: uuid NOT NULL default=gen_random_uuid() app_id: uuid NOT NULL pattern: text NOT NULL shape: text NOT NULL shape_key: text NOT NULL created_at: timestamp with time zone NOT NULL default=now() table: app_members app_id: uuid NOT NULL user_id: uuid NOT NULL role: text NOT NULL created_at: timestamp with time zone NOT NULL default=now() table: app_secrets app_id: uuid NOT NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() realtime_signing_key_encrypted: bytea NULL realtime_signing_key_nonce: bytea NULL realtime_signing_key_version: smallint NOT NULL default=0 table: app_slug_history slug: text NOT NULL current_app_id: uuid NOT NULL retired_at: timestamp with time zone NOT NULL default=now() table: app_user_email_verifications token_hash: text NOT NULL app_id: uuid NOT NULL user_id: uuid NOT NULL created_at: timestamp with time zone NOT NULL default=now() expires_at: timestamp with time zone NOT NULL consumed_at: timestamp with time zone NULL table: app_user_invitations id: uuid NOT NULL default=gen_random_uuid() token_hash: text NOT NULL app_id: uuid NOT NULL email: text NOT NULL display_name: text NULL roles: ARRAY NOT NULL default='{}'::text[] created_at: timestamp with time zone NOT NULL default=now() expires_at: timestamp with time zone NOT NULL accepted_at: timestamp with time zone NULL table: app_user_password_resets token_hash: text NOT NULL app_id: uuid NOT NULL user_id: uuid NOT NULL created_at: timestamp with time zone NOT NULL default=now() expires_at: timestamp with time zone NOT NULL consumed_at: timestamp with time zone NULL table: app_user_roles app_id: uuid NOT NULL user_id: uuid NOT NULL role: text NOT NULL created_at: timestamp with time zone NOT NULL default=now() table: app_user_sessions token_hash: text NOT NULL app_id: uuid NOT NULL user_id: uuid NOT NULL created_at: timestamp with time zone NOT NULL default=now() last_used_at: timestamp with time zone NOT NULL default=now() expires_at: timestamp with time zone NOT NULL absolute_expires_at: timestamp with time zone NOT NULL revoked_at: timestamp with time zone NULL table: app_users id: uuid NOT NULL default=gen_random_uuid() app_id: uuid NOT NULL email: text NOT NULL password_hash: text NOT NULL display_name: text NULL email_verified_at: timestamp with time zone NULL last_login_at: timestamp with time zone NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() table: apps id: uuid NOT NULL default=gen_random_uuid() slug: text NOT NULL name: text NOT NULL description: text NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() group_id: uuid NOT NULL environment: text NULL table: cron_trigger_details trigger_id: uuid NOT NULL schedule: text NOT NULL timezone: text NOT NULL default='UTC'::text last_fired_at: timestamp with time zone NULL table: dead_letter_trigger_details trigger_id: uuid NOT NULL source_filter: text NULL trigger_id_filter: uuid NULL script_id_filter: uuid NULL table: dead_letters id: uuid NOT NULL default=gen_random_uuid() app_id: uuid NOT NULL original_event_id: uuid NOT NULL source: text NOT NULL op: text NOT NULL trigger_id: uuid NULL script_id: uuid NULL payload: jsonb NOT NULL attempt_count: integer NOT NULL first_attempt_at: timestamp with time zone NOT NULL last_attempt_at: timestamp with time zone NOT NULL last_error: text NOT NULL created_at: timestamp with time zone NOT NULL default=now() resolved_at: timestamp with time zone NULL resolution: text NULL table: docs app_id: uuid NOT NULL collection: text NOT NULL id: uuid NOT NULL data: jsonb NOT NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() table: docs_trigger_details trigger_id: uuid NOT NULL collection_glob: text NOT NULL ops: ARRAY NOT NULL table: email_trigger_details trigger_id: uuid NOT NULL inbound_secret_encrypted: bytea NULL inbound_secret_nonce: bytea NULL table: execution_logs id: uuid NOT NULL default=gen_random_uuid() script_id: uuid NULL request_id: uuid NOT NULL request_path: text NULL request_headers: jsonb NOT NULL default='{}'::jsonb request_body: jsonb NULL response_code: integer NULL response_body: jsonb NULL logs: jsonb NOT NULL default='[]'::jsonb duration_ms: integer NOT NULL default=0 status: text NOT NULL created_at: timestamp with time zone NOT NULL default=now() app_id: uuid NOT NULL source: text NOT NULL default='http'::text table: files app_id: uuid NOT NULL collection: text NOT NULL id: uuid NOT NULL name: text NOT NULL content_type: text NOT NULL size_bytes: bigint NOT NULL checksum_sha256: text NOT NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() table: files_trigger_details trigger_id: uuid NOT NULL collection_glob: text NOT NULL ops: ARRAY NOT NULL table: group_members group_id: uuid NOT NULL user_id: uuid NOT NULL role: text NOT NULL created_at: timestamp with time zone NOT NULL default=now() table: groups id: uuid NOT NULL default=gen_random_uuid() parent_id: uuid NULL slug: text NOT NULL name: text NOT NULL description: text NULL structure_version: bigint NOT NULL default=1 owner_project: uuid NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() table: kv_entries app_id: uuid NOT NULL collection: text NOT NULL key: text NOT NULL value: jsonb NOT NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() table: kv_trigger_details trigger_id: uuid NOT NULL collection_glob: text NOT NULL ops: ARRAY NOT NULL table: outbox id: uuid NOT NULL default=gen_random_uuid() app_id: uuid NOT NULL source_kind: text NOT NULL trigger_id: uuid NULL script_id: uuid NULL reply_to: uuid NULL payload: jsonb NOT NULL origin_principal: uuid NULL trigger_depth: integer NOT NULL default=0 root_execution_id: uuid NULL attempt_count: integer NOT NULL default=0 next_attempt_at: timestamp with time zone NOT NULL default=now() claimed_at: timestamp with time zone NULL claimed_by: text NULL created_at: timestamp with time zone NOT NULL default=now() table: pubsub_trigger_details trigger_id: uuid NOT NULL topic_pattern: text NOT NULL table: queue_messages id: uuid NOT NULL default=gen_random_uuid() app_id: uuid NOT NULL queue_name: text NOT NULL payload: jsonb NOT NULL enqueued_at: timestamp with time zone NOT NULL default=now() deliver_after: timestamp with time zone NULL claim_token: uuid NULL claimed_at: timestamp with time zone NULL attempt: integer NOT NULL default=0 max_attempts: integer NOT NULL default=3 enqueued_by_principal: uuid NULL table: queue_trigger_details trigger_id: uuid NOT NULL queue_name: text NOT NULL visibility_timeout_secs: integer NOT NULL default=30 last_fired_at: timestamp with time zone NULL table: routes id: uuid NOT NULL default=gen_random_uuid() script_id: uuid NOT NULL host_kind: text NOT NULL host: text NOT NULL default=''::text host_param_name: text NULL path_kind: text NOT NULL path: text NOT NULL method: text NULL created_at: timestamp with time zone NOT NULL default=now() app_id: uuid NOT NULL dispatch_mode: text NOT NULL default='sync'::text enabled: boolean NOT NULL default=true table: script_imports app_id: uuid NOT NULL importer_script_id: uuid NOT NULL imported_script_id: uuid NOT NULL created_at: timestamp with time zone NOT NULL default=now() table: scripts id: uuid NOT NULL default=gen_random_uuid() name: text NOT NULL description: text NULL version: integer NOT NULL default=1 source: text NOT NULL timeout_seconds: integer NOT NULL default=30 memory_limit_mb: integer NOT NULL default=256 created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() sandbox: jsonb NOT NULL default='{}'::jsonb app_id: uuid NULL kind: text NOT NULL default='endpoint'::text enabled: boolean NOT NULL default=true group_id: uuid NULL table: secrets app_id: uuid NULL name: text NOT NULL encrypted_value: bytea NOT NULL nonce: bytea NOT NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() version: smallint NOT NULL default=0 group_id: uuid NULL environment_scope: text NOT NULL default='*'::text table: topics app_id: uuid NOT NULL name: text NOT NULL external_subscribable: boolean NOT NULL default=false auth_mode: text NOT NULL default='public'::text created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() table: triggers id: uuid NOT NULL default=gen_random_uuid() app_id: uuid NOT NULL script_id: uuid NOT NULL kind: text NOT NULL enabled: boolean NOT NULL default=true dispatch_mode: text NOT NULL default='async'::text retry_max_attempts: integer NOT NULL retry_backoff: text NOT NULL retry_base_ms: integer NOT NULL registered_by_principal: uuid NOT NULL created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() name: text NOT NULL default=(gen_random_uuid())::text table: vars id: uuid NOT NULL default=gen_random_uuid() group_id: uuid NULL app_id: uuid NULL environment_scope: text NOT NULL default='*'::text key: text NOT NULL value: jsonb NOT NULL is_tombstone: boolean NOT NULL default=false created_at: timestamp with time zone NOT NULL default=now() updated_at: timestamp with time zone NOT NULL default=now() ## indexes indexes on abandoned_executions: abandoned_executions_pkey: public.abandoned_executions USING btree (id) idx_abandoned_executions_gc: public.abandoned_executions USING btree (created_at) indexes on admin_sessions: admin_sessions_expiry_idx: public.admin_sessions USING btree (expires_at) admin_sessions_pkey: public.admin_sessions USING btree (token_hash) admin_sessions_user_idx: public.admin_sessions USING btree (user_id) indexes on admin_users: admin_users_email_key: public.admin_users USING btree (email) admin_users_instance_role_idx: public.admin_users USING btree (instance_role) admin_users_pkey: public.admin_users USING btree (id) admin_users_username_key: public.admin_users USING btree (username) indexes on api_keys: api_keys_pkey: public.api_keys USING btree (id) api_keys_prefix_idx: public.api_keys USING btree (prefix) api_keys_user_id_idx: public.api_keys USING btree (user_id) indexes on app_domains: app_domains_app_id_idx: public.app_domains USING btree (app_id) app_domains_pkey: public.app_domains USING btree (id) app_domains_shape_key_key: public.app_domains USING btree (shape_key) indexes on app_members: app_members_pkey: public.app_members USING btree (app_id, user_id) app_members_user_id_idx: public.app_members USING btree (user_id) indexes on app_secrets: app_secrets_pkey: public.app_secrets USING btree (app_id) indexes on app_slug_history: app_slug_history_pkey: public.app_slug_history USING btree (slug) indexes on app_user_email_verifications: app_user_email_verifications_pkey: public.app_user_email_verifications USING btree (token_hash) idx_app_user_email_verifications_user: public.app_user_email_verifications USING btree (app_id, user_id) indexes on app_user_invitations: app_user_invitations_pkey: public.app_user_invitations USING btree (id) app_user_invitations_token_hash_key: public.app_user_invitations USING btree (token_hash) idx_app_user_invitations_app_pending: public.app_user_invitations USING btree (app_id) WHERE (accepted_at IS NULL) idx_app_user_invitations_unique_pending: public.app_user_invitations USING btree (app_id, lower(email)) WHERE (accepted_at IS NULL) indexes on app_user_password_resets: app_user_password_resets_pkey: public.app_user_password_resets USING btree (token_hash) idx_app_user_password_resets_user: public.app_user_password_resets USING btree (app_id, user_id) indexes on app_user_roles: app_user_roles_pkey: public.app_user_roles USING btree (app_id, user_id, role) idx_app_user_roles_user: public.app_user_roles USING btree (app_id, user_id) indexes on app_user_sessions: app_user_sessions_pkey: public.app_user_sessions USING btree (token_hash) idx_app_user_sessions_expiry: public.app_user_sessions USING btree (expires_at) WHERE (revoked_at IS NULL) idx_app_user_sessions_user: public.app_user_sessions USING btree (app_id, user_id) indexes on app_users: app_users_pkey: public.app_users USING btree (id) idx_app_users_app: public.app_users USING btree (app_id) idx_app_users_app_email_lower: public.app_users USING btree (app_id, lower(email)) indexes on apps: apps_group_id_idx: public.apps USING btree (group_id) apps_pkey: public.apps USING btree (id) apps_slug_key: public.apps USING btree (slug) indexes on cron_trigger_details: cron_trigger_details_pkey: public.cron_trigger_details USING btree (trigger_id) indexes on dead_letter_trigger_details: dead_letter_trigger_details_pkey: public.dead_letter_trigger_details USING btree (trigger_id) indexes on dead_letters: dead_letters_pkey: public.dead_letters USING btree (id) idx_dead_letters_app_created: public.dead_letters USING btree (app_id, created_at DESC) idx_dead_letters_app_unresolved: public.dead_letters USING btree (app_id) WHERE (resolved_at IS NULL) idx_dead_letters_gc: public.dead_letters USING btree (created_at) indexes on docs: docs_pkey: public.docs USING btree (app_id, collection, id) idx_docs_app_collection: public.docs USING btree (app_id, collection) idx_docs_data_gin: public.docs USING gin (data jsonb_path_ops) indexes on docs_trigger_details: docs_trigger_details_pkey: public.docs_trigger_details USING btree (trigger_id) indexes on email_trigger_details: email_trigger_details_pkey: public.email_trigger_details USING btree (trigger_id) indexes on execution_logs: execution_logs_app_id_created_at_idx: public.execution_logs USING btree (app_id, created_at DESC) execution_logs_pkey: public.execution_logs USING btree (id) execution_logs_script_id_created_at_idx: public.execution_logs USING btree (script_id, created_at DESC) indexes on files: files_pkey: public.files USING btree (app_id, collection, id) idx_files_app_collection: public.files USING btree (app_id, collection) indexes on files_trigger_details: files_trigger_details_pkey: public.files_trigger_details USING btree (trigger_id) indexes on group_members: group_members_pkey: public.group_members USING btree (group_id, user_id) group_members_user_id_idx: public.group_members USING btree (user_id) indexes on groups: groups_parent_id_idx: public.groups USING btree (parent_id) groups_pkey: public.groups USING btree (id) groups_slug_key: public.groups USING btree (slug) indexes on kv_entries: idx_kv_entries_app_collection: public.kv_entries USING btree (app_id, collection) kv_entries_pkey: public.kv_entries USING btree (app_id, collection, key) indexes on kv_trigger_details: kv_trigger_details_pkey: public.kv_trigger_details USING btree (trigger_id) indexes on outbox: idx_outbox_app: public.outbox USING btree (app_id) idx_outbox_due: public.outbox USING btree (next_attempt_at) WHERE (claimed_at IS NULL) outbox_pkey: public.outbox USING btree (id) indexes on pubsub_trigger_details: pubsub_trigger_details_pkey: public.pubsub_trigger_details USING btree (trigger_id) indexes on queue_messages: idx_queue_messages_app_queue: public.queue_messages USING btree (app_id, queue_name) idx_queue_messages_claimed: public.queue_messages USING btree (claimed_at) WHERE (claim_token IS NOT NULL) idx_queue_messages_dispatch: public.queue_messages USING btree (app_id, queue_name, enqueued_at) WHERE (claim_token IS NULL) queue_messages_pkey: public.queue_messages USING btree (id) indexes on queue_trigger_details: idx_queue_trigger_details_queue_name: public.queue_trigger_details USING btree (queue_name) queue_trigger_details_pkey: public.queue_trigger_details USING btree (trigger_id) indexes on routes: routes_app_id_idx: public.routes USING btree (app_id) routes_lookup_idx: public.routes USING btree (host_kind, host) routes_pkey: public.routes USING btree (id) routes_script_id_idx: public.routes USING btree (script_id) routes_unique_binding_idx: public.routes USING btree (app_id, host_kind, host, path_kind, path, COALESCE(method, ''::text)) indexes on script_imports: idx_script_imports_app: public.script_imports USING btree (app_id) idx_script_imports_imported: public.script_imports USING btree (imported_script_id) script_imports_pkey: public.script_imports USING btree (importer_script_id, imported_script_id) indexes on scripts: idx_scripts_app_kind: public.scripts USING btree (app_id, kind) scripts_app_id_idx: public.scripts USING btree (app_id) scripts_app_name_uidx: public.scripts USING btree (app_id, lower(name)) WHERE (app_id IS NOT NULL) scripts_group_id_idx: public.scripts USING btree (group_id) WHERE (group_id IS NOT NULL) scripts_group_name_uidx: public.scripts USING btree (group_id, lower(name)) WHERE (group_id IS NOT NULL) scripts_pkey: public.scripts USING btree (id) indexes on secrets: idx_secrets_app: public.secrets USING btree (app_id) idx_secrets_group: public.secrets USING btree (group_id) WHERE (group_id IS NOT NULL) secrets_app_uidx: public.secrets USING btree (app_id, environment_scope, name) WHERE (app_id IS NOT NULL) secrets_group_uidx: public.secrets USING btree (group_id, environment_scope, name) WHERE (group_id IS NOT NULL) indexes on topics: topics_pkey: public.topics USING btree (app_id, name) indexes on triggers: idx_triggers_app_kind_enabled: public.triggers USING btree (app_id, kind) WHERE (enabled = true) idx_triggers_app_pubsub_enabled: public.triggers USING btree (app_id, kind) WHERE ((enabled = true) AND (kind = 'pubsub'::text)) idx_triggers_kind_enabled: public.triggers USING btree (kind) WHERE (enabled = true) triggers_app_name_uniq: public.triggers USING btree (app_id, name) triggers_pkey: public.triggers USING btree (id) indexes on vars: vars_app_id_idx: public.vars USING btree (app_id) WHERE (app_id IS NOT NULL) vars_app_uidx: public.vars USING btree (app_id, environment_scope, key) WHERE (app_id IS NOT NULL) vars_group_id_idx: public.vars USING btree (group_id) WHERE (group_id IS NOT NULL) vars_group_uidx: public.vars USING btree (group_id, environment_scope, key) WHERE (group_id IS NOT NULL) vars_pkey: public.vars USING btree (id) ## constraints constraints on abandoned_executions: [FOREIGN KEY] abandoned_executions_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] abandoned_executions_pkey: PRIMARY KEY (id) constraints on admin_sessions: [FOREIGN KEY] admin_sessions_user_id_fkey: FOREIGN KEY (user_id) REFERENCES admin_users(id) ON DELETE CASCADE [PRIMARY KEY] admin_sessions_pkey: PRIMARY KEY (token_hash) constraints on admin_users: [CHECK] admin_users_instance_role_check: CHECK ((instance_role = ANY (ARRAY['owner'::text, 'admin'::text, 'member'::text]))) [PRIMARY KEY] admin_users_pkey: PRIMARY KEY (id) [UNIQUE] admin_users_email_key: UNIQUE (email) [UNIQUE] admin_users_username_key: UNIQUE (username) constraints on api_keys: [FOREIGN KEY] api_keys_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] api_keys_user_id_fkey: FOREIGN KEY (user_id) REFERENCES admin_users(id) ON DELETE CASCADE [PRIMARY KEY] api_keys_pkey: PRIMARY KEY (id) constraints on app_domains: [CHECK] app_domains_shape_check: CHECK ((shape = ANY (ARRAY['exact'::text, 'wildcard'::text, 'parameterized'::text]))) [FOREIGN KEY] app_domains_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] app_domains_pkey: PRIMARY KEY (id) [UNIQUE] app_domains_shape_key_key: UNIQUE (shape_key) constraints on app_members: [CHECK] app_members_role_check: CHECK ((role = ANY (ARRAY['app_admin'::text, 'editor'::text, 'viewer'::text]))) [FOREIGN KEY] app_members_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] app_members_user_id_fkey: FOREIGN KEY (user_id) REFERENCES admin_users(id) ON DELETE CASCADE [PRIMARY KEY] app_members_pkey: PRIMARY KEY (app_id, user_id) constraints on app_secrets: [CHECK] app_secrets_realtime_signing_key_pair: CHECK (((realtime_signing_key_encrypted IS NULL) = (realtime_signing_key_nonce IS NULL))) [FOREIGN KEY] app_secrets_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] app_secrets_pkey: PRIMARY KEY (app_id) constraints on app_slug_history: [FOREIGN KEY] app_slug_history_current_app_id_fkey: FOREIGN KEY (current_app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] app_slug_history_pkey: PRIMARY KEY (slug) constraints on app_user_email_verifications: [FOREIGN KEY] app_user_email_verifications_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] app_user_email_verifications_user_id_fkey: FOREIGN KEY (user_id) REFERENCES app_users(id) ON DELETE CASCADE [PRIMARY KEY] app_user_email_verifications_pkey: PRIMARY KEY (token_hash) constraints on app_user_invitations: [FOREIGN KEY] app_user_invitations_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] app_user_invitations_pkey: PRIMARY KEY (id) [UNIQUE] app_user_invitations_token_hash_key: UNIQUE (token_hash) constraints on app_user_password_resets: [FOREIGN KEY] app_user_password_resets_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] app_user_password_resets_user_id_fkey: FOREIGN KEY (user_id) REFERENCES app_users(id) ON DELETE CASCADE [PRIMARY KEY] app_user_password_resets_pkey: PRIMARY KEY (token_hash) constraints on app_user_roles: [FOREIGN KEY] app_user_roles_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] app_user_roles_user_id_fkey: FOREIGN KEY (user_id) REFERENCES app_users(id) ON DELETE CASCADE [PRIMARY KEY] app_user_roles_pkey: PRIMARY KEY (app_id, user_id, role) constraints on app_user_sessions: [FOREIGN KEY] app_user_sessions_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] app_user_sessions_user_id_fkey: FOREIGN KEY (user_id) REFERENCES app_users(id) ON DELETE CASCADE [PRIMARY KEY] app_user_sessions_pkey: PRIMARY KEY (token_hash) constraints on app_users: [FOREIGN KEY] app_users_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] app_users_pkey: PRIMARY KEY (id) constraints on apps: [FOREIGN KEY] apps_group_id_fk: FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE RESTRICT [PRIMARY KEY] apps_pkey: PRIMARY KEY (id) [UNIQUE] apps_slug_key: UNIQUE (slug) constraints on cron_trigger_details: [FOREIGN KEY] cron_trigger_details_trigger_id_fkey: FOREIGN KEY (trigger_id) REFERENCES triggers(id) ON DELETE CASCADE [PRIMARY KEY] cron_trigger_details_pkey: PRIMARY KEY (trigger_id) constraints on dead_letter_trigger_details: [FOREIGN KEY] dead_letter_trigger_details_trigger_id_fkey: FOREIGN KEY (trigger_id) REFERENCES triggers(id) ON DELETE CASCADE [PRIMARY KEY] dead_letter_trigger_details_pkey: PRIMARY KEY (trigger_id) constraints on dead_letters: [CHECK] dead_letters_resolution_check: CHECK ((resolution = ANY (ARRAY['replayed'::text, 'ignored'::text, 'handled_by_script'::text, 'handler_failed'::text]))) [FOREIGN KEY] dead_letters_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] dead_letters_pkey: PRIMARY KEY (id) constraints on docs: [FOREIGN KEY] docs_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] docs_pkey: PRIMARY KEY (app_id, collection, id) constraints on docs_trigger_details: [FOREIGN KEY] docs_trigger_details_trigger_id_fkey: FOREIGN KEY (trigger_id) REFERENCES triggers(id) ON DELETE CASCADE [PRIMARY KEY] docs_trigger_details_pkey: PRIMARY KEY (trigger_id) constraints on email_trigger_details: [CHECK] email_trigger_details_inbound_secret_pair: CHECK (((inbound_secret_encrypted IS NULL) = (inbound_secret_nonce IS NULL))) [FOREIGN KEY] email_trigger_details_trigger_id_fkey: FOREIGN KEY (trigger_id) REFERENCES triggers(id) ON DELETE CASCADE [PRIMARY KEY] email_trigger_details_pkey: PRIMARY KEY (trigger_id) constraints on execution_logs: [CHECK] execution_logs_source_check: CHECK ((source = ANY (ARRAY['http'::text, 'kv'::text, 'docs'::text, 'dead_letter'::text, 'cron'::text, 'files'::text, 'pubsub'::text, 'email'::text, 'invoke'::text, 'queue'::text]))) [CHECK] execution_logs_status_check: CHECK ((status = ANY (ARRAY['success'::text, 'error'::text, 'timeout'::text, 'budget_exceeded'::text]))) [FOREIGN KEY] execution_logs_app_id_fk: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] execution_logs_script_id_fkey: FOREIGN KEY (script_id) REFERENCES scripts(id) ON DELETE SET NULL [PRIMARY KEY] execution_logs_pkey: PRIMARY KEY (id) constraints on files: [FOREIGN KEY] files_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] files_pkey: PRIMARY KEY (app_id, collection, id) constraints on files_trigger_details: [FOREIGN KEY] files_trigger_details_trigger_id_fkey: FOREIGN KEY (trigger_id) REFERENCES triggers(id) ON DELETE CASCADE [PRIMARY KEY] files_trigger_details_pkey: PRIMARY KEY (trigger_id) constraints on group_members: [CHECK] group_members_role_check: CHECK ((role = ANY (ARRAY['app_admin'::text, 'editor'::text, 'viewer'::text]))) [FOREIGN KEY] group_members_group_id_fkey: FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE [FOREIGN KEY] group_members_user_id_fkey: FOREIGN KEY (user_id) REFERENCES admin_users(id) ON DELETE CASCADE [PRIMARY KEY] group_members_pkey: PRIMARY KEY (group_id, user_id) constraints on groups: [FOREIGN KEY] groups_parent_id_fkey: FOREIGN KEY (parent_id) REFERENCES groups(id) ON DELETE RESTRICT [PRIMARY KEY] groups_pkey: PRIMARY KEY (id) [UNIQUE] groups_slug_key: UNIQUE (slug) constraints on kv_entries: [FOREIGN KEY] kv_entries_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] kv_entries_pkey: PRIMARY KEY (app_id, collection, key) constraints on kv_trigger_details: [FOREIGN KEY] kv_trigger_details_trigger_id_fkey: FOREIGN KEY (trigger_id) REFERENCES triggers(id) ON DELETE CASCADE [PRIMARY KEY] kv_trigger_details_pkey: PRIMARY KEY (trigger_id) constraints on outbox: [CHECK] outbox_source_kind_check: CHECK ((source_kind = ANY (ARRAY['http'::text, 'kv'::text, 'dead_letter'::text, 'docs'::text, 'cron'::text, 'files'::text, 'pubsub'::text, 'email'::text, 'invoke'::text]))) [FOREIGN KEY] outbox_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] outbox_pkey: PRIMARY KEY (id) constraints on pubsub_trigger_details: [FOREIGN KEY] pubsub_trigger_details_trigger_id_fkey: FOREIGN KEY (trigger_id) REFERENCES triggers(id) ON DELETE CASCADE [PRIMARY KEY] pubsub_trigger_details_pkey: PRIMARY KEY (trigger_id) constraints on queue_messages: [FOREIGN KEY] queue_messages_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] queue_messages_pkey: PRIMARY KEY (id) constraints on queue_trigger_details: [FOREIGN KEY] queue_trigger_details_trigger_id_fkey: FOREIGN KEY (trigger_id) REFERENCES triggers(id) ON DELETE CASCADE [PRIMARY KEY] queue_trigger_details_pkey: PRIMARY KEY (trigger_id) constraints on routes: [CHECK] routes_dispatch_mode_check: CHECK ((dispatch_mode = ANY (ARRAY['sync'::text, 'async'::text]))) [CHECK] routes_host_kind_check: CHECK ((host_kind = ANY (ARRAY['any'::text, 'strict'::text, 'wildcard'::text]))) [CHECK] routes_path_kind_check: CHECK ((path_kind = ANY (ARRAY['exact'::text, 'prefix'::text, 'param'::text]))) [FOREIGN KEY] routes_app_id_fk: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] routes_script_id_fkey: FOREIGN KEY (script_id) REFERENCES scripts(id) ON DELETE CASCADE [PRIMARY KEY] routes_pkey: PRIMARY KEY (id) constraints on script_imports: [FOREIGN KEY] script_imports_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] script_imports_imported_script_id_fkey: FOREIGN KEY (imported_script_id) REFERENCES scripts(id) ON DELETE CASCADE [FOREIGN KEY] script_imports_importer_script_id_fkey: FOREIGN KEY (importer_script_id) REFERENCES scripts(id) ON DELETE CASCADE [PRIMARY KEY] script_imports_pkey: PRIMARY KEY (importer_script_id, imported_script_id) constraints on scripts: [CHECK] scripts_kind_check: CHECK ((kind = ANY (ARRAY['endpoint'::text, 'module'::text]))) [CHECK] scripts_memory_limit_mb_check: CHECK (((memory_limit_mb > 0) AND (memory_limit_mb <= 2048))) [CHECK] scripts_module_name_shape: CHECK (((kind <> 'module'::text) OR (name ~ '^[a-zA-Z_][a-zA-Z0-9_]{0,63}$'::text))) [CHECK] scripts_owner_exactly_one: CHECK (((group_id IS NULL) <> (app_id IS NULL))) [CHECK] scripts_timeout_seconds_check: CHECK (((timeout_seconds > 0) AND (timeout_seconds <= 300))) [FOREIGN KEY] scripts_app_id_fk: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE RESTRICT [FOREIGN KEY] scripts_group_id_fkey: FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE RESTRICT [PRIMARY KEY] scripts_pkey: PRIMARY KEY (id) constraints on secrets: [CHECK] secrets_owner_exactly_one: CHECK (((group_id IS NULL) <> (app_id IS NULL))) [FOREIGN KEY] secrets_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] secrets_group_id_fkey: FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE constraints on topics: [CHECK] topics_auth_mode_check: CHECK ((auth_mode = ANY (ARRAY['public'::text, 'token'::text, 'session'::text]))) [FOREIGN KEY] topics_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [PRIMARY KEY] topics_pkey: PRIMARY KEY (app_id, name) constraints on triggers: [CHECK] triggers_dispatch_mode_check: CHECK ((dispatch_mode = ANY (ARRAY['sync'::text, 'async'::text]))) [CHECK] triggers_kind_check: CHECK ((kind = ANY (ARRAY['kv'::text, 'dead_letter'::text, 'docs'::text, 'cron'::text, 'files'::text, 'pubsub'::text, 'email'::text, 'queue'::text]))) [CHECK] triggers_retry_backoff_check: CHECK ((retry_backoff = ANY (ARRAY['exponential'::text, 'linear'::text, 'constant'::text]))) [FOREIGN KEY] triggers_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] triggers_registered_by_principal_fkey: FOREIGN KEY (registered_by_principal) REFERENCES admin_users(id) ON DELETE CASCADE [FOREIGN KEY] triggers_script_id_fkey: FOREIGN KEY (script_id) REFERENCES scripts(id) ON DELETE CASCADE [PRIMARY KEY] triggers_pkey: PRIMARY KEY (id) constraints on vars: [CHECK] vars_owner_exactly_one: CHECK (((group_id IS NULL) <> (app_id IS NULL))) [FOREIGN KEY] vars_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE [FOREIGN KEY] vars_group_id_fkey: FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE [PRIMARY KEY] vars_pkey: PRIMARY KEY (id) ## applied migrations 0001: init 0002: sandbox 0003: routes 0004: admin auth 0005: apps 0006: users authz 0007: kv 0008: triggers 0009: outbox 0010: dead letters 0011: abandoned executions 0012: routes dispatch mode 0013: docs 0014: docs triggers 0015: scripts kind 0016: script imports 0017: cron triggers 0018: files 0019: files triggers 0020: pubsub triggers 0021: topics 0022: app secrets 0023: secrets 0024: email triggers 0025: encrypt realtime keys 0026: app users 0027: app user sessions 0028: app user email verifications 0029: app user password resets 0030: app user invitations 0031: app user roles 0032: drop plaintext realtime signing key 0033: topics auth mode session 0034: queue messages 0035: queue triggers 0036: index triggers kind enabled 0037: drop idx cron triggers due 0038: email realtime secret check 0039: app user invitations unique pending 0040: execution logs keep history 0041: dead letters composite idx 0042: secrets envelope version 0043: execution logs source 0044: delete reserved path routes 0045: scripts routes enabled 0046: trigger name 0047: groups 0048: vars 0049: group secrets 0050: group scripts