{ "id": "9271dc62-0e72-4a40-8302-6fcfc013fd5e", "prevId": "d58655bd-3d4f-4701-9883-3caef9944882", "version": "7", "dialect": "postgresql", "tables": { "public.audit_events": { "name": "audit_events", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "occurred_at": { "name": "occurred_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "actor_user_id": { "name": "actor_user_id", "type": "uuid", "primaryKey": false, "notNull": false }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": false }, "action": { "name": "action", "type": "text", "primaryKey": false, "notNull": true }, "resource_type": { "name": "resource_type", "type": "text", "primaryKey": false, "notNull": true }, "resource_id": { "name": "resource_id", "type": "text", "primaryKey": false, "notNull": false }, "request_id": { "name": "request_id", "type": "text", "primaryKey": false, "notNull": false }, "outcome": { "name": "outcome", "type": "text", "primaryKey": false, "notNull": true }, "metadata_json": { "name": "metadata_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" } }, "indexes": { "audit_events_workspace_time_idx": { "name": "audit_events_workspace_time_idx", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "occurred_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "audit_events_action_time_idx": { "name": "audit_events_action_time_idx", "columns": [ { "expression": "action", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "occurred_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "audit_events_actor_user_fk": { "name": "audit_events_actor_user_fk", "tableFrom": "audit_events", "tableTo": "users", "columnsFrom": [ "actor_user_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "audit_events_workspace_fk": { "name": "audit_events_workspace_fk", "tableFrom": "audit_events", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "audit_events_outcome_check": { "name": "audit_events_outcome_check", "value": "\"audit_events\".\"outcome\" in ('success', 'denied', 'failed')" } }, "isRLSEnabled": false }, "public.auth_sessions": { "name": "auth_sessions", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "token_hash": { "name": "token_hash", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "last_seen_at": { "name": "last_seen_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "idle_expires_at": { "name": "idle_expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "absolute_expires_at": { "name": "absolute_expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "revoked_at": { "name": "revoked_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "source_ip_hash": { "name": "source_ip_hash", "type": "text", "primaryKey": false, "notNull": false }, "user_agent_summary": { "name": "user_agent_summary", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": { "auth_sessions_user_active_idx": { "name": "auth_sessions_user_active_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "absolute_expires_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "where": "\"auth_sessions\".\"revoked_at\" is null", "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "auth_sessions_user_fk": { "name": "auth_sessions_user_fk", "tableFrom": "auth_sessions", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "auth_sessions_token_hash_uq": { "name": "auth_sessions_token_hash_uq", "nullsNotDistinct": false, "columns": [ "token_hash" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.collection_items": { "name": "collection_items", "schema": "", "columns": { "collection_id": { "name": "collection_id", "type": "uuid", "primaryKey": false, "notNull": true }, "playbook_id": { "name": "playbook_id", "type": "uuid", "primaryKey": false, "notNull": true }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "added_at": { "name": "added_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "collection_items_collection_fk": { "name": "collection_items_collection_fk", "tableFrom": "collection_items", "tableTo": "collections", "columnsFrom": [ "collection_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "collection_items_playbook_fk": { "name": "collection_items_playbook_fk", "tableFrom": "collection_items", "tableTo": "playbooks", "columnsFrom": [ "playbook_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": { "collection_items_pkey": { "name": "collection_items_pkey", "columns": [ "collection_id", "playbook_id" ] } }, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.collections": { "name": "collections", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": true, "default": "''" }, "created_by": { "name": "created_by", "type": "uuid", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "collections_workspace_fk": { "name": "collections_workspace_fk", "tableFrom": "collections", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "collections_created_by_fk": { "name": "collections_created_by_fk", "tableFrom": "collections", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "collections_workspace_name_uq": { "name": "collections_workspace_name_uq", "nullsNotDistinct": false, "columns": [ "workspace_id", "name" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.composition_drafts": { "name": "composition_drafts", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": true }, "playbook_version_id": { "name": "playbook_version_id", "type": "uuid", "primaryKey": false, "notNull": true }, "repository_profile_revision_id": { "name": "repository_profile_revision_id", "type": "uuid", "primaryKey": false, "notNull": false }, "input_json": { "name": "input_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "scope_override_json": { "name": "scope_override_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "policy_override_json": { "name": "policy_override_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "autonomy_level": { "name": "autonomy_level", "type": "text", "primaryKey": false, "notNull": true }, "work_mode": { "name": "work_mode", "type": "text", "primaryKey": false, "notNull": true }, "output_format": { "name": "output_format", "type": "text", "primaryKey": false, "notNull": true, "default": "'prompt'" }, "last_render_digest": { "name": "last_render_digest", "type": "text", "primaryKey": false, "notNull": false }, "revision": { "name": "revision", "type": "integer", "primaryKey": false, "notNull": true, "default": 1 }, "created_by": { "name": "created_by", "type": "uuid", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "composition_drafts_workspace_updated_idx": { "name": "composition_drafts_workspace_updated_idx", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "updated_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "composition_drafts_workspace_fk": { "name": "composition_drafts_workspace_fk", "tableFrom": "composition_drafts", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "composition_drafts_playbook_version_fk": { "name": "composition_drafts_playbook_version_fk", "tableFrom": "composition_drafts", "tableTo": "playbook_versions", "columnsFrom": [ "playbook_version_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "composition_drafts_profile_revision_fk": { "name": "composition_drafts_profile_revision_fk", "tableFrom": "composition_drafts", "tableTo": "repository_profile_revisions", "columnsFrom": [ "repository_profile_revision_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "composition_drafts_created_by_fk": { "name": "composition_drafts_created_by_fk", "tableFrom": "composition_drafts", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "composition_drafts_revision_positive_check": { "name": "composition_drafts_revision_positive_check", "value": "\"composition_drafts\".\"revision\" > 0" }, "composition_drafts_autonomy_check": { "name": "composition_drafts_autonomy_check", "value": "\"composition_drafts\".\"autonomy_level\" in ('observe', 'diagnose', 'plan', 'implement', 'verify', 'repair')" }, "composition_drafts_work_mode_check": { "name": "composition_drafts_work_mode_check", "value": "\"composition_drafts\".\"work_mode\" in ('inspect', 'plan', 'guided', 'execute', 'recovery')" }, "composition_drafts_output_format_check": { "name": "composition_drafts_output_format_check", "value": "\"composition_drafts\".\"output_format\" in ('prompt', 'markdown', 'run-pack')" }, "composition_drafts_last_render_digest_check": { "name": "composition_drafts_last_render_digest_check", "value": "\"composition_drafts\".\"last_render_digest\" is null or \"composition_drafts\".\"last_render_digest\" ~ '^[0-9a-f]{64}$'" } }, "isRLSEnabled": false }, "public.evaluation_cases": { "name": "evaluation_cases", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "playbook_version_id": { "name": "playbook_version_id", "type": "uuid", "primaryKey": false, "notNull": true }, "logical_case_id": { "name": "logical_case_id", "type": "text", "primaryKey": false, "notNull": true }, "fixture_version": { "name": "fixture_version", "type": "text", "primaryKey": false, "notNull": true }, "case_json": { "name": "case_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "case_digest": { "name": "case_digest", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "evaluation_cases_playbook_version_fk": { "name": "evaluation_cases_playbook_version_fk", "tableFrom": "evaluation_cases", "tableTo": "playbook_versions", "columnsFrom": [ "playbook_version_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "evaluation_cases_identity_uq": { "name": "evaluation_cases_identity_uq", "nullsNotDistinct": false, "columns": [ "playbook_version_id", "logical_case_id", "fixture_version" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.evaluation_results": { "name": "evaluation_results", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "evaluation_case_id": { "name": "evaluation_case_id", "type": "uuid", "primaryKey": false, "notNull": true }, "environment_json": { "name": "environment_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true }, "dimension_scores_json": { "name": "dimension_scores_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "evidence_artifact_id": { "name": "evidence_artifact_id", "type": "uuid", "primaryKey": false, "notNull": false }, "executed_by": { "name": "executed_by", "type": "uuid", "primaryKey": false, "notNull": false }, "executed_at": { "name": "executed_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "evaluation_results_case_fk": { "name": "evaluation_results_case_fk", "tableFrom": "evaluation_results", "tableTo": "evaluation_cases", "columnsFrom": [ "evaluation_case_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "evaluation_results_artifact_fk": { "name": "evaluation_results_artifact_fk", "tableFrom": "evaluation_results", "tableTo": "generated_artifacts", "columnsFrom": [ "evidence_artifact_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "evaluation_results_executed_by_fk": { "name": "evaluation_results_executed_by_fk", "tableFrom": "evaluation_results", "tableTo": "users", "columnsFrom": [ "executed_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "evaluation_results_status_check": { "name": "evaluation_results_status_check", "value": "\"evaluation_results\".\"status\" in ('passed', 'failed', 'error', 'skipped', 'stale')" } }, "isRLSEnabled": false }, "public.favorites": { "name": "favorites", "schema": "", "columns": { "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "playbook_id": { "name": "playbook_id", "type": "uuid", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "favorites_workspace_fk": { "name": "favorites_workspace_fk", "tableFrom": "favorites", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "favorites_user_fk": { "name": "favorites_user_fk", "tableFrom": "favorites", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "favorites_playbook_fk": { "name": "favorites_playbook_fk", "tableFrom": "favorites", "tableTo": "playbooks", "columnsFrom": [ "playbook_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": { "favorites_pkey": { "name": "favorites_pkey", "columns": [ "workspace_id", "user_id", "playbook_id" ] } }, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.generated_artifacts": { "name": "generated_artifacts", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "run_id": { "name": "run_id", "type": "uuid", "primaryKey": false, "notNull": true }, "artifact_type": { "name": "artifact_type", "type": "text", "primaryKey": false, "notNull": true }, "storage_key": { "name": "storage_key", "type": "text", "primaryKey": false, "notNull": true }, "filename": { "name": "filename", "type": "text", "primaryKey": false, "notNull": true }, "media_type": { "name": "media_type", "type": "text", "primaryKey": false, "notNull": true }, "size_bytes": { "name": "size_bytes", "type": "bigint", "primaryKey": false, "notNull": true }, "sha256": { "name": "sha256", "type": "text", "primaryKey": false, "notNull": true }, "expires_at": { "name": "expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "generated_artifacts_run_fk": { "name": "generated_artifacts_run_fk", "tableFrom": "generated_artifacts", "tableTo": "generated_runs", "columnsFrom": [ "run_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "generated_artifacts_storage_key_uq": { "name": "generated_artifacts_storage_key_uq", "nullsNotDistinct": false, "columns": [ "storage_key" ] } }, "policies": {}, "checkConstraints": { "generated_artifacts_type_check": { "name": "generated_artifacts_type_check", "value": "\"generated_artifacts\".\"artifact_type\" in ('prompt_text', 'markdown', 'run_pack_zip', 'agents_suggestion', 'support_bundle')" }, "generated_artifacts_size_check": { "name": "generated_artifacts_size_check", "value": "\"generated_artifacts\".\"size_bytes\" >= 0" } }, "isRLSEnabled": false }, "public.generated_runs": { "name": "generated_runs", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": true }, "source_draft_id": { "name": "source_draft_id", "type": "uuid", "primaryKey": false, "notNull": false }, "playbook_version_id": { "name": "playbook_version_id", "type": "uuid", "primaryKey": false, "notNull": true }, "playbook_snapshot_json": { "name": "playbook_snapshot_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "repository_profile_snapshot_json": { "name": "repository_profile_snapshot_json", "type": "jsonb", "primaryKey": false, "notNull": false }, "normalized_input_json": { "name": "normalized_input_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "policy_snapshot_json": { "name": "policy_snapshot_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "provenance_json": { "name": "provenance_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "lint_result_json": { "name": "lint_result_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "rendered_prompt": { "name": "rendered_prompt", "type": "text", "primaryKey": false, "notNull": true }, "render_digest": { "name": "render_digest", "type": "text", "primaryKey": false, "notNull": true }, "idempotency_key": { "name": "idempotency_key", "type": "text", "primaryKey": false, "notNull": true }, "generated_by": { "name": "generated_by", "type": "uuid", "primaryKey": false, "notNull": true }, "generated_at": { "name": "generated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "generated_runs_digest_actor_uq": { "name": "generated_runs_digest_actor_uq", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "generated_by", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "render_digest", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "generated_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} }, "generated_runs_workspace_time_idx": { "name": "generated_runs_workspace_time_idx", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "generated_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "generated_runs_workspace_fk": { "name": "generated_runs_workspace_fk", "tableFrom": "generated_runs", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "generated_runs_source_draft_fk": { "name": "generated_runs_source_draft_fk", "tableFrom": "generated_runs", "tableTo": "composition_drafts", "columnsFrom": [ "source_draft_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "generated_runs_playbook_version_fk": { "name": "generated_runs_playbook_version_fk", "tableFrom": "generated_runs", "tableTo": "playbook_versions", "columnsFrom": [ "playbook_version_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "generated_runs_generated_by_fk": { "name": "generated_runs_generated_by_fk", "tableFrom": "generated_runs", "tableTo": "users", "columnsFrom": [ "generated_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "generated_runs_workspace_idempotency_uq": { "name": "generated_runs_workspace_idempotency_uq", "nullsNotDistinct": false, "columns": [ "workspace_id", "idempotency_key" ] } }, "policies": {}, "checkConstraints": { "generated_runs_render_digest_check": { "name": "generated_runs_render_digest_check", "value": "\"generated_runs\".\"render_digest\" ~ '^[0-9a-f]{64}$'" }, "generated_runs_idempotency_key_check": { "name": "generated_runs_idempotency_key_check", "value": "length(\"generated_runs\".\"idempotency_key\") between 1 and 255 and btrim(\"generated_runs\".\"idempotency_key\") = \"generated_runs\".\"idempotency_key\"" } }, "isRLSEnabled": false }, "public.instance_settings": { "name": "instance_settings", "schema": "", "columns": { "singleton": { "name": "singleton", "type": "boolean", "primaryKey": true, "notNull": true, "default": true }, "setup_completed_at": { "name": "setup_completed_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "owner_user_id": { "name": "owner_user_id", "type": "uuid", "primaryKey": false, "notNull": false }, "config_json": { "name": "config_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "config_digest": { "name": "config_digest", "type": "text", "primaryKey": false, "notNull": false }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "instance_settings_owner_user_fk": { "name": "instance_settings_owner_user_fk", "tableFrom": "instance_settings", "tableTo": "users", "columnsFrom": [ "owner_user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "instance_settings_singleton_check": { "name": "instance_settings_singleton_check", "value": "\"instance_settings\".\"singleton\"" } }, "isRLSEnabled": false }, "public.integration_secrets": { "name": "integration_secrets", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "integration_id": { "name": "integration_id", "type": "uuid", "primaryKey": false, "notNull": true }, "secret_kind": { "name": "secret_kind", "type": "text", "primaryKey": false, "notNull": true }, "envelope_version": { "name": "envelope_version", "type": "integer", "primaryKey": false, "notNull": true }, "key_version": { "name": "key_version", "type": "text", "primaryKey": false, "notNull": true }, "nonce": { "name": "nonce", "type": "bytea", "primaryKey": false, "notNull": true }, "ciphertext": { "name": "ciphertext", "type": "bytea", "primaryKey": false, "notNull": true }, "auth_tag": { "name": "auth_tag", "type": "bytea", "primaryKey": false, "notNull": true }, "last_four": { "name": "last_four", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "rotated_at": { "name": "rotated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "integration_secrets_integration_fk": { "name": "integration_secrets_integration_fk", "tableFrom": "integration_secrets", "tableTo": "integrations", "columnsFrom": [ "integration_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "integration_secrets_integration_kind_uq": { "name": "integration_secrets_integration_kind_uq", "nullsNotDistinct": false, "columns": [ "integration_id", "secret_kind" ] } }, "policies": {}, "checkConstraints": { "integration_secrets_envelope_version_check": { "name": "integration_secrets_envelope_version_check", "value": "\"integration_secrets\".\"envelope_version\" = 1" }, "integration_secrets_key_version_check": { "name": "integration_secrets_key_version_check", "value": "length(btrim(\"integration_secrets\".\"key_version\")) between 1 and 64" }, "integration_secrets_secret_kind_check": { "name": "integration_secrets_secret_kind_check", "value": "\"integration_secrets\".\"secret_kind\" = 'access_token'" }, "integration_secrets_nonce_length_check": { "name": "integration_secrets_nonce_length_check", "value": "octet_length(\"integration_secrets\".\"nonce\") = 12" }, "integration_secrets_auth_tag_length_check": { "name": "integration_secrets_auth_tag_length_check", "value": "octet_length(\"integration_secrets\".\"auth_tag\") = 16" }, "integration_secrets_last_four_check": { "name": "integration_secrets_last_four_check", "value": "\"integration_secrets\".\"last_four\" is null or length(\"integration_secrets\".\"last_four\") = 4" } }, "isRLSEnabled": false }, "public.integrations": { "name": "integrations", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true }, "display_name": { "name": "display_name", "type": "text", "primaryKey": false, "notNull": true }, "base_url": { "name": "base_url", "type": "text", "primaryKey": false, "notNull": true }, "allow_private_http": { "name": "allow_private_http", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "request_timeout_ms": { "name": "request_timeout_ms", "type": "integer", "primaryKey": false, "notNull": true, "default": 15000 }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'configured'" }, "capabilities_json": { "name": "capabilities_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "server_version": { "name": "server_version", "type": "text", "primaryKey": false, "notNull": false }, "remote_identity_id": { "name": "remote_identity_id", "type": "text", "primaryKey": false, "notNull": false }, "remote_identity_login": { "name": "remote_identity_login", "type": "text", "primaryKey": false, "notNull": false }, "health_code": { "name": "health_code", "type": "text", "primaryKey": false, "notNull": false }, "last_checked_at": { "name": "last_checked_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "uuid", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "integrations_workspace_status_idx": { "name": "integrations_workspace_status_idx", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "status", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "updated_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "integrations_workspace_fk": { "name": "integrations_workspace_fk", "tableFrom": "integrations", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "integrations_created_by_fk": { "name": "integrations_created_by_fk", "tableFrom": "integrations", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "integrations_workspace_type_base_url_uq": { "name": "integrations_workspace_type_base_url_uq", "nullsNotDistinct": false, "columns": [ "workspace_id", "type", "base_url" ] } }, "policies": {}, "checkConstraints": { "integrations_type_check": { "name": "integrations_type_check", "value": "\"integrations\".\"type\" in ('gitea')" }, "integrations_status_check": { "name": "integrations_status_check", "value": "\"integrations\".\"status\" in ('configured', 'healthy', 'degraded', 'disabled')" }, "integrations_request_timeout_check": { "name": "integrations_request_timeout_check", "value": "\"integrations\".\"request_timeout_ms\" between 1000 and 60000" }, "integrations_remote_identity_check": { "name": "integrations_remote_identity_check", "value": "(\"integrations\".\"remote_identity_id\" is null) = (\"integrations\".\"remote_identity_login\" is null)" }, "integrations_health_code_check": { "name": "integrations_health_code_check", "value": "\"integrations\".\"health_code\" is null or \"integrations\".\"health_code\" in ('AUTH_INVALID', 'PERMISSION_MISSING', 'CAPABILITY_UNSUPPORTED', 'RATE_LIMITED', 'NETWORK_BLOCKED', 'TLS_ERROR', 'REMOTE_UNAVAILABLE', 'CONTENT_TOO_LARGE')" } }, "isRLSEnabled": false }, "public.invitations": { "name": "invitations", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true }, "token_hash": { "name": "token_hash", "type": "text", "primaryKey": false, "notNull": true }, "instance_role": { "name": "instance_role", "type": "text", "primaryKey": false, "notNull": true }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": false }, "workspace_role": { "name": "workspace_role", "type": "text", "primaryKey": false, "notNull": false }, "expires_at": { "name": "expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "accepted_at": { "name": "accepted_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "uuid", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "invitations_workspace_fk": { "name": "invitations_workspace_fk", "tableFrom": "invitations", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "invitations_created_by_fk": { "name": "invitations_created_by_fk", "tableFrom": "invitations", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "invitations_token_hash_uq": { "name": "invitations_token_hash_uq", "nullsNotDistinct": false, "columns": [ "token_hash" ] } }, "policies": {}, "checkConstraints": { "invitations_instance_role_check": { "name": "invitations_instance_role_check", "value": "\"invitations\".\"instance_role\" in ('instance_admin', 'user')" }, "invitations_workspace_role_check": { "name": "invitations_workspace_role_check", "value": "\"invitations\".\"workspace_role\" is null or \"invitations\".\"workspace_role\" in ('owner', 'editor', 'viewer')" } }, "isRLSEnabled": false }, "public.jobs": { "name": "jobs", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": false }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true }, "state": { "name": "state", "type": "text", "primaryKey": false, "notNull": true }, "idempotency_key": { "name": "idempotency_key", "type": "text", "primaryKey": false, "notNull": false }, "payload_json": { "name": "payload_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "progress_json": { "name": "progress_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "attempt_count": { "name": "attempt_count", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "max_attempts": { "name": "max_attempts", "type": "integer", "primaryKey": false, "notNull": true, "default": 3 }, "lease_owner": { "name": "lease_owner", "type": "text", "primaryKey": false, "notNull": false }, "lease_expires_at": { "name": "lease_expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "available_at": { "name": "available_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "started_at": { "name": "started_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "finished_at": { "name": "finished_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "error_code": { "name": "error_code", "type": "text", "primaryKey": false, "notNull": false }, "error_detail_redacted": { "name": "error_detail_redacted", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "jobs_workspace_type_idempotency_uq": { "name": "jobs_workspace_type_idempotency_uq", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "type", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "idempotency_key", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "where": "\"jobs\".\"workspace_id\" is not null and \"jobs\".\"idempotency_key\" is not null", "concurrently": false, "method": "btree", "with": {} }, "jobs_global_type_idempotency_uq": { "name": "jobs_global_type_idempotency_uq", "columns": [ { "expression": "type", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "idempotency_key", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "where": "\"jobs\".\"workspace_id\" is null and \"jobs\".\"idempotency_key\" is not null", "concurrently": false, "method": "btree", "with": {} }, "jobs_claim_idx": { "name": "jobs_claim_idx", "columns": [ { "expression": "state", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "available_at", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "where": "\"jobs\".\"state\" = 'queued'", "concurrently": false, "method": "btree", "with": {} }, "jobs_lease_idx": { "name": "jobs_lease_idx", "columns": [ { "expression": "state", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "lease_expires_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "where": "\"jobs\".\"state\" = 'running'", "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "jobs_workspace_fk": { "name": "jobs_workspace_fk", "tableFrom": "jobs", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "jobs_state_check": { "name": "jobs_state_check", "value": "\"jobs\".\"state\" in ('queued', 'running', 'succeeded', 'failed', 'cancelled')" }, "jobs_attempt_count_check": { "name": "jobs_attempt_count_check", "value": "\"jobs\".\"attempt_count\" >= 0" }, "jobs_max_attempts_check": { "name": "jobs_max_attempts_check", "value": "\"jobs\".\"max_attempts\" > 0" } }, "isRLSEnabled": false }, "public.password_reset_tokens": { "name": "password_reset_tokens", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "token_hash": { "name": "token_hash", "type": "text", "primaryKey": false, "notNull": true }, "expires_at": { "name": "expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "used_at": { "name": "used_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "uuid", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "password_reset_tokens_user_fk": { "name": "password_reset_tokens_user_fk", "tableFrom": "password_reset_tokens", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "password_reset_tokens_created_by_fk": { "name": "password_reset_tokens_created_by_fk", "tableFrom": "password_reset_tokens", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "password_reset_tokens_token_hash_uq": { "name": "password_reset_tokens_token_hash_uq", "nullsNotDistinct": false, "columns": [ "token_hash" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.playbook_package_files": { "name": "playbook_package_files", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "playbook_version_id": { "name": "playbook_version_id", "type": "uuid", "primaryKey": false, "notNull": true }, "path": { "name": "path", "type": "text", "primaryKey": false, "notNull": true }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": true }, "content": { "name": "content", "type": "bytea", "primaryKey": false, "notNull": true }, "size_bytes": { "name": "size_bytes", "type": "bigint", "primaryKey": false, "notNull": true }, "sha256": { "name": "sha256", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "playbook_package_files_version_idx": { "name": "playbook_package_files_version_idx", "columns": [ { "expression": "playbook_version_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "playbook_package_files_version_fk": { "name": "playbook_package_files_version_fk", "tableFrom": "playbook_package_files", "tableTo": "playbook_versions", "columnsFrom": [ "playbook_version_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "playbook_package_files_version_path_uq": { "name": "playbook_package_files_version_path_uq", "nullsNotDistinct": false, "columns": [ "playbook_version_id", "path" ] } }, "policies": {}, "checkConstraints": { "playbook_package_files_path_check": { "name": "playbook_package_files_path_check", "value": "length(\"playbook_package_files\".\"path\") between 1 and 512 and \"playbook_package_files\".\"path\" = btrim(\"playbook_package_files\".\"path\") and \"playbook_package_files\".\"path\" !~ '(^/|\\\\|//|(^|/)\\.\\.?(/|$))'" }, "playbook_package_files_role_check": { "name": "playbook_package_files_role_check", "value": "\"playbook_package_files\".\"role\" in ('manifest', 'template', 'partial', 'documentation', 'changelog', 'example', 'evaluation', 'resource', 'run-pack-resource')" }, "playbook_package_files_size_check": { "name": "playbook_package_files_size_check", "value": "\"playbook_package_files\".\"size_bytes\" between 0 and 5242880 and octet_length(\"playbook_package_files\".\"content\") = \"playbook_package_files\".\"size_bytes\"" }, "playbook_package_files_sha256_check": { "name": "playbook_package_files_sha256_check", "value": "\"playbook_package_files\".\"sha256\" ~ '^[0-9a-f]{64}$' and encode(digest(\"playbook_package_files\".\"content\", 'sha256'), 'hex') = \"playbook_package_files\".\"sha256\"" } }, "isRLSEnabled": false }, "public.playbook_versions": { "name": "playbook_versions", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "playbook_id": { "name": "playbook_id", "type": "uuid", "primaryKey": false, "notNull": true }, "semantic_version": { "name": "semantic_version", "type": "text", "primaryKey": false, "notNull": true }, "lifecycle": { "name": "lifecycle", "type": "text", "primaryKey": false, "notNull": true }, "package_api_version": { "name": "package_api_version", "type": "text", "primaryKey": false, "notNull": true }, "title": { "name": "title", "type": "text", "primaryKey": false, "notNull": true }, "summary": { "name": "summary", "type": "text", "primaryKey": false, "notNull": true }, "category": { "name": "category", "type": "text", "primaryKey": false, "notNull": true }, "risk_tier": { "name": "risk_tier", "type": "text", "primaryKey": false, "notNull": true }, "package_json": { "name": "package_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "template_text": { "name": "template_text", "type": "text", "primaryKey": false, "notNull": true }, "content_digest": { "name": "content_digest", "type": "text", "primaryKey": false, "notNull": true }, "draft_revision": { "name": "draft_revision", "type": "integer", "primaryKey": false, "notNull": true, "default": 1 }, "draft_digest": { "name": "draft_digest", "type": "text", "primaryKey": false, "notNull": true, "default": "repeat('0', 64)" }, "draft_validation_json": { "name": "draft_validation_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{\"valid\":true,\"issues\":[]}'::jsonb" }, "search_document": { "name": "search_document", "type": "tsvector", "primaryKey": false, "notNull": false }, "published_at": { "name": "published_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "supersedes_version_id": { "name": "supersedes_version_id", "type": "uuid", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "uuid", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "playbook_versions_search_idx": { "name": "playbook_versions_search_idx", "columns": [ { "expression": "search_document", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "gin", "with": {} }, "playbook_versions_filters_idx": { "name": "playbook_versions_filters_idx", "columns": [ { "expression": "category", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "risk_tier", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "lifecycle", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "published_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "playbook_versions_playbook_fk": { "name": "playbook_versions_playbook_fk", "tableFrom": "playbook_versions", "tableTo": "playbooks", "columnsFrom": [ "playbook_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "playbook_versions_supersedes_fk": { "name": "playbook_versions_supersedes_fk", "tableFrom": "playbook_versions", "tableTo": "playbook_versions", "columnsFrom": [ "supersedes_version_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "playbook_versions_created_by_fk": { "name": "playbook_versions_created_by_fk", "tableFrom": "playbook_versions", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "playbook_versions_playbook_semver_uq": { "name": "playbook_versions_playbook_semver_uq", "nullsNotDistinct": false, "columns": [ "playbook_id", "semantic_version" ] } }, "policies": {}, "checkConstraints": { "playbook_versions_lifecycle_check": { "name": "playbook_versions_lifecycle_check", "value": "\"playbook_versions\".\"lifecycle\" in ('draft', 'reviewed', 'validated', 'battle-tested', 'deprecated')" }, "playbook_versions_risk_tier_check": { "name": "playbook_versions_risk_tier_check", "value": "\"playbook_versions\".\"risk_tier\" in ('low', 'moderate', 'high', 'critical')" }, "playbook_versions_draft_revision_check": { "name": "playbook_versions_draft_revision_check", "value": "\"playbook_versions\".\"draft_revision\" > 0" }, "playbook_versions_draft_digest_check": { "name": "playbook_versions_draft_digest_check", "value": "\"playbook_versions\".\"draft_digest\" ~ '^[0-9a-f]{64}$'" }, "playbook_versions_draft_validation_check": { "name": "playbook_versions_draft_validation_check", "value": "jsonb_typeof(\"playbook_versions\".\"draft_validation_json\") = 'object'" } }, "isRLSEnabled": false }, "public.playbooks": { "name": "playbooks", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": false }, "logical_id": { "name": "logical_id", "type": "text", "primaryKey": false, "notNull": true }, "slug": { "name": "slug", "type": "text", "primaryKey": false, "notNull": true }, "namespace": { "name": "namespace", "type": "text", "primaryKey": false, "notNull": true }, "source_type": { "name": "source_type", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "playbooks_workspace_idx": { "name": "playbooks_workspace_idx", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "playbooks_workspace_fk": { "name": "playbooks_workspace_fk", "tableFrom": "playbooks", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "playbooks_namespace_logical_id_uq": { "name": "playbooks_namespace_logical_id_uq", "nullsNotDistinct": false, "columns": [ "namespace", "logical_id" ] }, "playbooks_namespace_slug_uq": { "name": "playbooks_namespace_slug_uq", "nullsNotDistinct": false, "columns": [ "namespace", "slug" ] } }, "policies": {}, "checkConstraints": { "playbooks_source_type_check": { "name": "playbooks_source_type_check", "value": "\"playbooks\".\"source_type\" in ('built_in', 'private', 'imported', 'remote_registry')" } }, "isRLSEnabled": false }, "public.repositories": { "name": "repositories", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": true }, "display_name": { "name": "display_name", "type": "text", "primaryKey": false, "notNull": true }, "source_type": { "name": "source_type", "type": "text", "primaryKey": false, "notNull": true }, "external_owner": { "name": "external_owner", "type": "text", "primaryKey": false, "notNull": false }, "external_name": { "name": "external_name", "type": "text", "primaryKey": false, "notNull": false }, "external_id": { "name": "external_id", "type": "text", "primaryKey": false, "notNull": false }, "integration_id": { "name": "integration_id", "type": "uuid", "primaryKey": false, "notNull": false }, "default_branch": { "name": "default_branch", "type": "text", "primaryKey": false, "notNull": false }, "archived": { "name": "archived", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "repositories_external_uq": { "name": "repositories_external_uq", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "integration_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "external_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "where": "\"repositories\".\"external_id\" is not null", "concurrently": false, "method": "btree", "with": {} }, "repositories_workspace_updated_idx": { "name": "repositories_workspace_updated_idx", "columns": [ { "expression": "workspace_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "archived", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "updated_at", "isExpression": false, "asc": false, "nulls": "last" }, { "expression": "id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "repositories_workspace_fk": { "name": "repositories_workspace_fk", "tableFrom": "repositories", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "repositories_integration_fk": { "name": "repositories_integration_fk", "tableFrom": "repositories", "tableTo": "integrations", "columnsFrom": [ "integration_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "repositories_source_type_check": { "name": "repositories_source_type_check", "value": "\"repositories\".\"source_type\" in ('manual', 'gitea')" } }, "isRLSEnabled": false }, "public.repository_findings": { "name": "repository_findings", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "snapshot_id": { "name": "snapshot_id", "type": "uuid", "primaryKey": false, "notNull": true }, "rule_id": { "name": "rule_id", "type": "text", "primaryKey": false, "notNull": true }, "severity": { "name": "severity", "type": "text", "primaryKey": false, "notNull": true }, "title": { "name": "title", "type": "text", "primaryKey": false, "notNull": true }, "rationale": { "name": "rationale", "type": "text", "primaryKey": false, "notNull": true }, "evidence_pointer": { "name": "evidence_pointer", "type": "text", "primaryKey": false, "notNull": true }, "recommended_playbook_slug": { "name": "recommended_playbook_slug", "type": "text", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'open'" }, "resolution_note": { "name": "resolution_note", "type": "text", "primaryKey": false, "notNull": false }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "repository_findings_snapshot_fk": { "name": "repository_findings_snapshot_fk", "tableFrom": "repository_findings", "tableTo": "repository_snapshots", "columnsFrom": [ "snapshot_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "repository_findings_evidence_uq": { "name": "repository_findings_evidence_uq", "nullsNotDistinct": false, "columns": [ "snapshot_id", "rule_id", "evidence_pointer" ] } }, "policies": {}, "checkConstraints": { "repository_findings_severity_check": { "name": "repository_findings_severity_check", "value": "\"repository_findings\".\"severity\" in ('info', 'low', 'medium', 'high', 'critical')" }, "repository_findings_status_check": { "name": "repository_findings_status_check", "value": "\"repository_findings\".\"status\" in ('open', 'dismissed', 'resolved')" } }, "isRLSEnabled": false }, "public.repository_profile_revisions": { "name": "repository_profile_revisions", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "repository_id": { "name": "repository_id", "type": "uuid", "primaryKey": false, "notNull": true }, "revision_number": { "name": "revision_number", "type": "integer", "primaryKey": false, "notNull": true }, "profile_json": { "name": "profile_json", "type": "jsonb", "primaryKey": false, "notNull": true }, "source_snapshot_id": { "name": "source_snapshot_id", "type": "uuid", "primaryKey": false, "notNull": false }, "content_digest": { "name": "content_digest", "type": "text", "primaryKey": false, "notNull": true }, "created_by": { "name": "created_by", "type": "uuid", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "repository_profile_revisions_repository_fk": { "name": "repository_profile_revisions_repository_fk", "tableFrom": "repository_profile_revisions", "tableTo": "repositories", "columnsFrom": [ "repository_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "repository_profile_revisions_snapshot_fk": { "name": "repository_profile_revisions_snapshot_fk", "tableFrom": "repository_profile_revisions", "tableTo": "repository_snapshots", "columnsFrom": [ "source_snapshot_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "repository_profile_revisions_created_by_fk": { "name": "repository_profile_revisions_created_by_fk", "tableFrom": "repository_profile_revisions", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "repository_profile_revisions_repository_number_uq": { "name": "repository_profile_revisions_repository_number_uq", "nullsNotDistinct": false, "columns": [ "repository_id", "revision_number" ] }, "repository_profile_revisions_repository_digest_uq": { "name": "repository_profile_revisions_repository_digest_uq", "nullsNotDistinct": false, "columns": [ "repository_id", "content_digest" ] } }, "policies": {}, "checkConstraints": { "repository_profile_revisions_revision_positive_check": { "name": "repository_profile_revisions_revision_positive_check", "value": "\"repository_profile_revisions\".\"revision_number\" > 0" }, "repository_profile_revisions_content_digest_check": { "name": "repository_profile_revisions_content_digest_check", "value": "\"repository_profile_revisions\".\"content_digest\" ~ '^[0-9a-f]{64}$'" } }, "isRLSEnabled": false }, "public.repository_snapshots": { "name": "repository_snapshots", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "repository_id": { "name": "repository_id", "type": "uuid", "primaryKey": false, "notNull": true }, "integration_id": { "name": "integration_id", "type": "uuid", "primaryKey": false, "notNull": false }, "state": { "name": "state", "type": "text", "primaryKey": false, "notNull": true }, "captured_at": { "name": "captured_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "capability_snapshot_json": { "name": "capability_snapshot_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "evidence_json": { "name": "evidence_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "evidence_digest": { "name": "evidence_digest", "type": "text", "primaryKey": false, "notNull": false }, "sync_job_id": { "name": "sync_job_id", "type": "uuid", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "repository_snapshots_sync_job_uq": { "name": "repository_snapshots_sync_job_uq", "columns": [ { "expression": "sync_job_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "where": "\"repository_snapshots\".\"sync_job_id\" is not null", "concurrently": false, "method": "btree", "with": {} }, "repository_snapshots_repo_time_idx": { "name": "repository_snapshots_repo_time_idx", "columns": [ { "expression": "repository_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "captured_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "repository_snapshots_integration_state_idx": { "name": "repository_snapshots_integration_state_idx", "columns": [ { "expression": "integration_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "state", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "repository_snapshots_repository_fk": { "name": "repository_snapshots_repository_fk", "tableFrom": "repository_snapshots", "tableTo": "repositories", "columnsFrom": [ "repository_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "repository_snapshots_integration_fk": { "name": "repository_snapshots_integration_fk", "tableFrom": "repository_snapshots", "tableTo": "integrations", "columnsFrom": [ "integration_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "repository_snapshots_job_fk": { "name": "repository_snapshots_job_fk", "tableFrom": "repository_snapshots", "tableTo": "jobs", "columnsFrom": [ "sync_job_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "repository_snapshots_state_check": { "name": "repository_snapshots_state_check", "value": "\"repository_snapshots\".\"state\" in ('collecting', 'complete', 'failed', 'cancelled')" }, "repository_snapshots_complete_integrity_check": { "name": "repository_snapshots_complete_integrity_check", "value": "\"repository_snapshots\".\"state\" <> 'complete' or (\"repository_snapshots\".\"captured_at\" is not null and \"repository_snapshots\".\"evidence_digest\" ~ '^[0-9a-f]{64}$')" } }, "isRLSEnabled": false }, "public.run_feedback": { "name": "run_feedback", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "run_id": { "name": "run_id", "type": "uuid", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "rating": { "name": "rating", "type": "text", "primaryKey": false, "notNull": false }, "notes": { "name": "notes", "type": "text", "primaryKey": false, "notNull": true, "default": "''" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "run_feedback_run_fk": { "name": "run_feedback_run_fk", "tableFrom": "run_feedback", "tableTo": "generated_runs", "columnsFrom": [ "run_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "run_feedback_user_fk": { "name": "run_feedback_user_fk", "tableFrom": "run_feedback", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "run_feedback_run_user_uq": { "name": "run_feedback_run_user_uq", "nullsNotDistinct": false, "columns": [ "run_id", "user_id" ] } }, "policies": {}, "checkConstraints": { "run_feedback_rating_check": { "name": "run_feedback_rating_check", "value": "\"run_feedback\".\"rating\" is null or \"run_feedback\".\"rating\" in ('helpful', 'mixed', 'unhelpful')" } }, "isRLSEnabled": false }, "public.users": { "name": "users", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true }, "display_name": { "name": "display_name", "type": "text", "primaryKey": false, "notNull": true }, "password_hash": { "name": "password_hash", "type": "text", "primaryKey": false, "notNull": true }, "email_verified": { "name": "email_verified", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "image": { "name": "image", "type": "text", "primaryKey": false, "notNull": false }, "instance_role": { "name": "instance_role", "type": "text", "primaryKey": false, "notNull": true }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'active'" }, "password_changed_at": { "name": "password_changed_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "deleted_at": { "name": "deleted_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false } }, "indexes": { "users_email_ci_uq": { "name": "users_email_ci_uq", "columns": [ { "expression": "lower(\"email\")", "asc": true, "isExpression": true, "nulls": "last" } ], "isUnique": true, "where": "\"users\".\"deleted_at\" is null", "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "users_instance_role_check": { "name": "users_instance_role_check", "value": "\"users\".\"instance_role\" in ('instance_owner', 'instance_admin', 'user')" }, "users_status_check": { "name": "users_status_check", "value": "\"users\".\"status\" in ('active', 'disabled', 'pending_deletion')" } }, "isRLSEnabled": false }, "public.workspace_memberships": { "name": "workspace_memberships", "schema": "", "columns": { "workspace_id": { "name": "workspace_id", "type": "uuid", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "workspace_memberships_user_idx": { "name": "workspace_memberships_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "workspace_memberships_workspace_fk": { "name": "workspace_memberships_workspace_fk", "tableFrom": "workspace_memberships", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "workspace_memberships_user_fk": { "name": "workspace_memberships_user_fk", "tableFrom": "workspace_memberships", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": { "workspace_memberships_pkey": { "name": "workspace_memberships_pkey", "columns": [ "workspace_id", "user_id" ] } }, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "workspace_memberships_role_check": { "name": "workspace_memberships_role_check", "value": "\"workspace_memberships\".\"role\" in ('owner', 'editor', 'viewer')" } }, "isRLSEnabled": false }, "public.workspaces": { "name": "workspaces", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true, "default": "'personal'" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "deleted_at": { "name": "deleted_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "workspaces_type_check": { "name": "workspaces_type_check", "value": "\"workspaces\".\"type\" in ('personal', 'team')" } }, "isRLSEnabled": false } }, "enums": {}, "schemas": {}, "sequences": {}, "roles": {}, "policies": {}, "views": {}, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }