{ "id": "30b9b909-c7b6-419a-8142-bd93865d77e0", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", "tables": { "public.agents": { "name": "agents", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuidv7()" }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "display_name": { "name": "display_name", "type": "text", "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()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "agents_role_idx": { "name": "agents_role_idx", "columns": [ { "expression": "role", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "agents_name_unique": { "name": "agents_name_unique", "nullsNotDistinct": false, "columns": ["name"] } }, "policies": {}, "checkConstraints": { "agents_name_check": { "name": "agents_name_check", "value": "\"agents\".\"name\" ~ '^[a-z0-9][a-z0-9-]{0,63}$'" }, "agents_display_name_check": { "name": "agents_display_name_check", "value": "length(\"agents\".\"display_name\") BETWEEN 1 AND 128" }, "agents_role_check": { "name": "agents_role_check", "value": "\"agents\".\"role\" IN ('admin', 'agent')" } }, "isRLSEnabled": false }, "public.api_tokens": { "name": "api_tokens", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuidv7()" }, "agent_id": { "name": "agent_id", "type": "uuid", "primaryKey": false, "notNull": true }, "hash_argon2id": { "name": "hash_argon2id", "type": "text", "primaryKey": false, "notNull": true }, "prefix": { "name": "prefix", "type": "text", "primaryKey": false, "notNull": true }, "scopes": { "name": "scopes", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'active'" }, "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()" }, "revoked_at": { "name": "revoked_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false } }, "indexes": { "api_tokens_agent_id_idx": { "name": "api_tokens_agent_id_idx", "columns": [ { "expression": "agent_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "api_tokens_active_prefix_idx": { "name": "api_tokens_active_prefix_idx", "columns": [ { "expression": "prefix", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "where": "\"api_tokens\".\"status\" = 'active'", "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "api_tokens_agent_id_agents_id_fk": { "name": "api_tokens_agent_id_agents_id_fk", "tableFrom": "api_tokens", "tableTo": "agents", "columnsFrom": ["agent_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "api_tokens_prefix_unique": { "name": "api_tokens_prefix_unique", "nullsNotDistinct": false, "columns": ["prefix"] } }, "policies": {}, "checkConstraints": { "api_tokens_prefix_check": { "name": "api_tokens_prefix_check", "value": "\"api_tokens\".\"prefix\" ~ '^ah_live_[a-zA-Z0-9]{4}$'" }, "api_tokens_status_check": { "name": "api_tokens_status_check", "value": "\"api_tokens\".\"status\" IN ('active', 'rotating', 'revoked')" }, "api_tokens_revoked_at_check": { "name": "api_tokens_revoked_at_check", "value": "\"api_tokens\".\"revoked_at\" IS NULL OR \"api_tokens\".\"status\" = 'revoked'" }, "api_tokens_expires_at_check": { "name": "api_tokens_expires_at_check", "value": "\"api_tokens\".\"expires_at\" IS NULL OR \"api_tokens\".\"expires_at\" > \"api_tokens\".\"created_at\"" } }, "isRLSEnabled": false }, "public.audit_events": { "name": "audit_events", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuidv7()" }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true }, "agent_id": { "name": "agent_id", "type": "uuid", "primaryKey": false, "notNull": false }, "payload_hash": { "name": "payload_hash", "type": "bytea", "primaryKey": false, "notNull": true }, "ts": { "name": "ts", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "audit_events_ts_idx": { "name": "audit_events_ts_idx", "columns": [ { "expression": "ts", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "audit_events_type_ts_idx": { "name": "audit_events_type_ts_idx", "columns": [ { "expression": "type", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "ts", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "audit_events_agent_ts_idx": { "name": "audit_events_agent_ts_idx", "columns": [ { "expression": "agent_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "ts", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "where": "\"audit_events\".\"agent_id\" IS NOT NULL", "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "audit_events_agent_id_agents_id_fk": { "name": "audit_events_agent_id_agents_id_fk", "tableFrom": "audit_events", "tableTo": "agents", "columnsFrom": ["agent_id"], "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "audit_events_type_check": { "name": "audit_events_type_check", "value": "\"audit_events\".\"type\" IN (\n 'login',\n 'token-issued',\n 'token-rotated',\n 'token-revoked',\n 'jwt-issued',\n 'agent-created',\n 'agent-deleted',\n 'room-created',\n 'room-deleted',\n 'message-sent'\n )" }, "audit_events_payload_hash_check": { "name": "audit_events_payload_hash_check", "value": "length(\"audit_events\".\"payload_hash\") = 32" } }, "isRLSEnabled": false }, "public.messages": { "name": "messages", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuidv7()" }, "room_id": { "name": "room_id", "type": "uuid", "primaryKey": false, "notNull": true }, "author_agent_id": { "name": "author_agent_id", "type": "uuid", "primaryKey": false, "notNull": true }, "body": { "name": "body", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "messages_room_created_at_idx": { "name": "messages_room_created_at_idx", "columns": [ { "expression": "room_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "\"created_at\" DESC", "asc": true, "isExpression": true, "nulls": "last" }, { "expression": "\"id\" DESC", "asc": true, "isExpression": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "messages_room_id_rooms_id_fk": { "name": "messages_room_id_rooms_id_fk", "tableFrom": "messages", "tableTo": "rooms", "columnsFrom": ["room_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, "messages_author_agent_id_agents_id_fk": { "name": "messages_author_agent_id_agents_id_fk", "tableFrom": "messages", "tableTo": "agents", "columnsFrom": ["author_agent_id"], "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "messages_body_check": { "name": "messages_body_check", "value": "length(\"messages\".\"body\") BETWEEN 1 AND 16384" } }, "isRLSEnabled": false }, "public.room_members": { "name": "room_members", "schema": "", "columns": { "room_id": { "name": "room_id", "type": "uuid", "primaryKey": false, "notNull": true }, "agent_id": { "name": "agent_id", "type": "uuid", "primaryKey": false, "notNull": true }, "joined_at": { "name": "joined_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "room_members_agent_id_idx": { "name": "room_members_agent_id_idx", "columns": [ { "expression": "agent_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "room_members_room_id_rooms_id_fk": { "name": "room_members_room_id_rooms_id_fk", "tableFrom": "room_members", "tableTo": "rooms", "columnsFrom": ["room_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, "room_members_agent_id_agents_id_fk": { "name": "room_members_agent_id_agents_id_fk", "tableFrom": "room_members", "tableTo": "agents", "columnsFrom": ["agent_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": { "room_members_room_id_agent_id_pk": { "name": "room_members_room_id_agent_id_pk", "columns": ["room_id", "agent_id"] } }, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.rooms": { "name": "rooms", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuidv7()" }, "slug": { "name": "slug", "type": "text", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "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": { "rooms_created_by_agents_id_fk": { "name": "rooms_created_by_agents_id_fk", "tableFrom": "rooms", "tableTo": "agents", "columnsFrom": ["created_by"], "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "rooms_slug_unique": { "name": "rooms_slug_unique", "nullsNotDistinct": false, "columns": ["slug"] } }, "policies": {}, "checkConstraints": { "rooms_slug_check": { "name": "rooms_slug_check", "value": "\"rooms\".\"slug\" ~ '^[a-z0-9][a-z0-9-]{0,63}$'" }, "rooms_name_check": { "name": "rooms_name_check", "value": "length(\"rooms\".\"name\") BETWEEN 1 AND 128" } }, "isRLSEnabled": false } }, "enums": {}, "schemas": {}, "sequences": {}, "roles": {}, "policies": {}, "views": {}, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }