{ "id": "438060dc-38bd-4e79-83e9-0da80c85f52c", "prevId": "c4e049ba-0c49-4d50-be15-07538c0af763", "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" }, "autonomy_level": { "name": "autonomy_level", "type": "text", "primaryKey": false, "notNull": true }, "work_mode": { "name": "work_mode", "type": "text", "primaryKey": false, "notNull": true }, "last_render_digest": { "name": "last_render_digest", "type": "text", "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": { "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": {}, "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": false }, "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": {}, "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": {}, "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 }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'configured'" }, "capabilities_json": { "name": "capabilities_json", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "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": {}, "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')" } }, "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_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 }, "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')" } }, "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": {} } }, "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": {}, "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_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": {} } }, "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')" } }, "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": {} } }