{ "id": "e5ccba31-990f-496c-8012-1f2de1a5b824", "prevId": "d807d54d-7d3d-43bc-9886-8e079973791d", "version": "7", "dialect": "postgresql", "tables": { "public.account": { "name": "account", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "account_id": { "name": "account_id", "type": "text", "primaryKey": false, "notNull": true }, "provider_id": { "name": "provider_id", "type": "text", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true }, "access_token": { "name": "access_token", "type": "text", "primaryKey": false, "notNull": false }, "refresh_token": { "name": "refresh_token", "type": "text", "primaryKey": false, "notNull": false }, "id_token": { "name": "id_token", "type": "text", "primaryKey": false, "notNull": false }, "access_token_expires_at": { "name": "access_token_expires_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "refresh_token_expires_at": { "name": "refresh_token_expires_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "scope": { "name": "scope", "type": "text", "primaryKey": false, "notNull": false }, "password": { "name": "password", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "account_user_id_user_id_fk": { "name": "account_user_id_user_id_fk", "tableFrom": "account", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.agent_profile": { "name": "agent_profile", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "enabled": { "name": "enabled", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "default": "'Asistente'" }, "tone": { "name": "tone", "type": "text", "primaryKey": false, "notNull": false }, "instructions": { "name": "instructions", "type": "text", "primaryKey": false, "notNull": false }, "escalation_rules": { "name": "escalation_rules", "type": "text", "primaryKey": false, "notNull": false }, "greeting": { "name": "greeting", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "agent_profile_org_uq": { "name": "agent_profile_org_uq", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "agent_profile_organization_id_organization_id_fk": { "name": "agent_profile_organization_id_organization_id_fk", "tableFrom": "agent_profile", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.agent_test_case": { "name": "agent_test_case", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "run_id": { "name": "run_id", "type": "text", "primaryKey": false, "notNull": true }, "persona": { "name": "persona", "type": "text", "primaryKey": false, "notNull": true }, "conversation_id": { "name": "conversation_id", "type": "text", "primaryKey": false, "notNull": false }, "transcript": { "name": "transcript", "type": "jsonb", "primaryKey": false, "notNull": false }, "veredicto": { "name": "veredicto", "type": "text", "primaryKey": false, "notNull": false }, "hallazgos": { "name": "hallazgos", "type": "jsonb", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'pending'" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "test_case_run_idx": { "name": "test_case_run_idx", "columns": [ { "expression": "run_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "agent_test_case_organization_id_organization_id_fk": { "name": "agent_test_case_organization_id_organization_id_fk", "tableFrom": "agent_test_case", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "agent_test_case_run_id_agent_test_run_id_fk": { "name": "agent_test_case_run_id_agent_test_run_id_fk", "tableFrom": "agent_test_case", "tableTo": "agent_test_run", "columnsFrom": [ "run_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "agent_test_case_conversation_id_conversation_id_fk": { "name": "agent_test_case_conversation_id_conversation_id_fk", "tableFrom": "agent_test_case", "tableTo": "conversation", "columnsFrom": [ "conversation_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.agent_test_run": { "name": "agent_test_run", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'running'" }, "score": { "name": "score", "type": "integer", "primaryKey": false, "notNull": false }, "error": { "name": "error", "type": "text", "primaryKey": false, "notNull": false }, "started_at": { "name": "started_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "finished_at": { "name": "finished_at", "type": "timestamp", "primaryKey": false, "notNull": false } }, "indexes": { "test_run_org_running_uq": { "name": "test_run_org_running_uq", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "where": "\"agent_test_run\".\"status\" = 'running'", "concurrently": false, "method": "btree", "with": {} }, "test_run_org_idx": { "name": "test_run_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "started_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "agent_test_run_organization_id_organization_id_fk": { "name": "agent_test_run_organization_id_organization_id_fk", "tableFrom": "agent_test_run", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.contact": { "name": "contact", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "wa_identity": { "name": "wa_identity", "type": "text", "primaryKey": false, "notNull": true }, "phone": { "name": "phone", "type": "text", "primaryKey": false, "notNull": false }, "wa_user_id": { "name": "wa_user_id", "type": "text", "primaryKey": false, "notNull": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "notes": { "name": "notes", "type": "text", "primaryKey": false, "notNull": false }, "archived_at": { "name": "archived_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "contact_org_wa_identity_uq": { "name": "contact_org_wa_identity_uq", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "wa_identity", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} }, "contact_org_wa_user_id_idx": { "name": "contact_org_wa_user_id_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "wa_user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "contact_org_name_idx": { "name": "contact_org_name_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "name", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "contact_organization_id_organization_id_fk": { "name": "contact_organization_id_organization_id_fk", "tableFrom": "contact", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.conversation": { "name": "conversation", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "contact_id": { "name": "contact_id", "type": "text", "primaryKey": false, "notNull": true }, "is_test": { "name": "is_test", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "ai_enabled": { "name": "ai_enabled", "type": "boolean", "primaryKey": false, "notNull": true, "default": true }, "handoff_at": { "name": "handoff_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "handoff_reason": { "name": "handoff_reason", "type": "text", "primaryKey": false, "notNull": false }, "last_inbound_at": { "name": "last_inbound_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "last_message_at": { "name": "last_message_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "unread_count": { "name": "unread_count", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "conversation_org_contact_real_uq": { "name": "conversation_org_contact_real_uq", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "contact_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "where": "\"conversation\".\"is_test\" = false", "concurrently": false, "method": "btree", "with": {} }, "conversation_org_last_idx": { "name": "conversation_org_last_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "last_message_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "conversation_organization_id_organization_id_fk": { "name": "conversation_organization_id_organization_id_fk", "tableFrom": "conversation", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "conversation_contact_id_contact_id_fk": { "name": "conversation_contact_id_contact_id_fk", "tableFrom": "conversation", "tableTo": "contact", "columnsFrom": [ "contact_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.invitation": { "name": "invitation", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'pending'" }, "expires_at": { "name": "expires_at", "type": "timestamp", "primaryKey": false, "notNull": true }, "inviter_id": { "name": "inviter_id", "type": "text", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "invitation_organization_id_organization_id_fk": { "name": "invitation_organization_id_organization_id_fk", "tableFrom": "invitation", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "invitation_inviter_id_user_id_fk": { "name": "invitation_inviter_id_user_id_fk", "tableFrom": "invitation", "tableTo": "user", "columnsFrom": [ "inviter_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.kb_entry": { "name": "kb_entry", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "kind": { "name": "kind", "type": "text", "primaryKey": false, "notNull": true }, "question": { "name": "question", "type": "text", "primaryKey": false, "notNull": false }, "answer": { "name": "answer", "type": "text", "primaryKey": false, "notNull": false }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "kb_org_idx": { "name": "kb_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "kb_entry_organization_id_organization_id_fk": { "name": "kb_entry_organization_id_organization_id_fk", "tableFrom": "kb_entry", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.lead": { "name": "lead", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "contact_id": { "name": "contact_id", "type": "text", "primaryKey": false, "notNull": true }, "stage_id": { "name": "stage_id", "type": "text", "primaryKey": false, "notNull": true }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "last_activity_at": { "name": "last_activity_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "lead_contact_uq": { "name": "lead_contact_uq", "columns": [ { "expression": "contact_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} }, "lead_org_stage_idx": { "name": "lead_org_stage_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "stage_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "position", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "lead_organization_id_organization_id_fk": { "name": "lead_organization_id_organization_id_fk", "tableFrom": "lead", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "lead_contact_id_contact_id_fk": { "name": "lead_contact_id_contact_id_fk", "tableFrom": "lead", "tableTo": "contact", "columnsFrom": [ "contact_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "lead_stage_id_pipeline_stage_id_fk": { "name": "lead_stage_id_pipeline_stage_id_fk", "tableFrom": "lead", "tableTo": "pipeline_stage", "columnsFrom": [ "stage_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.member": { "name": "member", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": true, "default": "'member'" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "member_organization_id_organization_id_fk": { "name": "member_organization_id_organization_id_fk", "tableFrom": "member", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "member_user_id_user_id_fk": { "name": "member_user_id_user_id_fk", "tableFrom": "member", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.message": { "name": "message", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "conversation_id": { "name": "conversation_id", "type": "text", "primaryKey": false, "notNull": true }, "wa_message_id": { "name": "wa_message_id", "type": "text", "primaryKey": false, "notNull": false }, "direction": { "name": "direction", "type": "text", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true, "default": "'text'" }, "text": { "name": "text", "type": "text", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'pending'" }, "error": { "name": "error", "type": "text", "primaryKey": false, "notNull": false }, "ai_generated": { "name": "ai_generated", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "wa_timestamp": { "name": "wa_timestamp", "type": "timestamp", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "message_org_conv_idx": { "name": "message_org_conv_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "conversation_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "message_organization_id_organization_id_fk": { "name": "message_organization_id_organization_id_fk", "tableFrom": "message", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "message_conversation_id_conversation_id_fk": { "name": "message_conversation_id_conversation_id_fk", "tableFrom": "message", "tableTo": "conversation", "columnsFrom": [ "conversation_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "message_wa_message_id_unique": { "name": "message_wa_message_id_unique", "nullsNotDistinct": false, "columns": [ "wa_message_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.meta_credentials": { "name": "meta_credentials", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "waba_id": { "name": "waba_id", "type": "text", "primaryKey": false, "notNull": true }, "phone_number_id": { "name": "phone_number_id", "type": "text", "primaryKey": false, "notNull": true }, "display_phone_number": { "name": "display_phone_number", "type": "text", "primaryKey": false, "notNull": false }, "verified_name": { "name": "verified_name", "type": "text", "primaryKey": false, "notNull": false }, "token_cipher": { "name": "token_cipher", "type": "text", "primaryKey": false, "notNull": true }, "token_iv": { "name": "token_iv", "type": "text", "primaryKey": false, "notNull": true }, "token_tag": { "name": "token_tag", "type": "text", "primaryKey": false, "notNull": true }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'connected'" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "meta_credentials_org_uq": { "name": "meta_credentials_org_uq", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} }, "meta_credentials_phone_uq": { "name": "meta_credentials_phone_uq", "columns": [ { "expression": "phone_number_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "meta_credentials_organization_id_organization_id_fk": { "name": "meta_credentials_organization_id_organization_id_fk", "tableFrom": "meta_credentials", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.organization": { "name": "organization", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "slug": { "name": "slug", "type": "text", "primaryKey": false, "notNull": false }, "logo": { "name": "logo", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "metadata": { "name": "metadata", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "organization_slug_unique": { "name": "organization_slug_unique", "nullsNotDistinct": false, "columns": [ "slug" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.pipeline_stage": { "name": "pipeline_stage", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true }, "kind": { "name": "kind", "type": "text", "primaryKey": false, "notNull": true, "default": "'open'" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "stage_org_pos_idx": { "name": "stage_org_pos_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "position", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "pipeline_stage_organization_id_organization_id_fk": { "name": "pipeline_stage_organization_id_organization_id_fk", "tableFrom": "pipeline_stage", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.session": { "name": "session", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "expires_at": { "name": "expires_at", "type": "timestamp", "primaryKey": false, "notNull": true }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "ip_address": { "name": "ip_address", "type": "text", "primaryKey": false, "notNull": false }, "user_agent": { "name": "user_agent", "type": "text", "primaryKey": false, "notNull": false }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true }, "active_organization_id": { "name": "active_organization_id", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "session_user_id_user_id_fk": { "name": "session_user_id_user_id_fk", "tableFrom": "session", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "session_token_unique": { "name": "session_token_unique", "nullsNotDistinct": false, "columns": [ "token" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.template": { "name": "template", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "language": { "name": "language", "type": "text", "primaryKey": false, "notNull": true }, "category": { "name": "category", "type": "text", "primaryKey": false, "notNull": true }, "body": { "name": "body", "type": "text", "primaryKey": false, "notNull": true }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'draft'" }, "rejection_reason": { "name": "rejection_reason", "type": "text", "primaryKey": false, "notNull": false }, "wa_template_id": { "name": "wa_template_id", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "template_org_name_lang_uq": { "name": "template_org_name_lang_uq", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "name", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "language", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "template_organization_id_organization_id_fk": { "name": "template_organization_id_organization_id_fk", "tableFrom": "template", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user": { "name": "user", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "email": { "name": "email", "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 }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "user_email_unique": { "name": "user_email_unique", "nullsNotDistinct": false, "columns": [ "email" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.verification": { "name": "verification", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "identifier": { "name": "identifier", "type": "text", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": true }, "expires_at": { "name": "expires_at", "type": "timestamp", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false } }, "enums": {}, "schemas": {}, "sequences": {}, "roles": {}, "policies": {}, "views": {}, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }