{ "id": "d73040d1-dddf-4b16-82f8-034bfaeba629", "prevId": "7448da6f-4f76-4ac2-b7d4-1d5c25b6ceb0", "version": "7", "dialect": "postgresql", "tables": { "public.automations": { "name": "automations", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "code": { "name": "code", "type": "text", "primaryKey": false, "notNull": true, "default": "''" }, "trigger": { "name": "trigger", "type": "varchar(50)", "primaryKey": false, "notNull": true, "default": "'manual'" }, "trigger_config": { "name": "trigger_config", "type": "jsonb", "primaryKey": false, "notNull": false }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "automations_org_idx": { "name": "automations_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "automations_organization_id_organizations_id_fk": { "name": "automations_organization_id_organizations_id_fk", "tableFrom": "automations", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "automations_created_by_users_id_fk": { "name": "automations_created_by_users_id_fk", "tableFrom": "automations", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.billing_transactions": { "name": "billing_transactions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "amount": { "name": "amount", "type": "numeric(10, 2)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(10)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "billing_transactions_organization_id_organizations_id_fk": { "name": "billing_transactions_organization_id_organizations_id_fk", "tableFrom": "billing_transactions", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.bookmark_folders": { "name": "bookmark_folders", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "parent_id": { "name": "parent_id", "type": "integer", "primaryKey": false, "notNull": false }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "is_expanded": { "name": "is_expanded", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "bookmark_folders_organization_id_organizations_id_fk": { "name": "bookmark_folders_organization_id_organizations_id_fk", "tableFrom": "bookmark_folders", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bookmark_folders_user_id_users_id_fk": { "name": "bookmark_folders_user_id_users_id_fk", "tableFrom": "bookmark_folders", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bookmark_folders_created_by_users_id_fk": { "name": "bookmark_folders_created_by_users_id_fk", "tableFrom": "bookmark_folders", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.bookmarks": { "name": "bookmarks", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "folder_id": { "name": "folder_id", "type": "integer", "primaryKey": false, "notNull": false }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "target_id": { "name": "target_id", "type": "integer", "primaryKey": false, "notNull": false }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": false }, "url": { "name": "url", "type": "varchar(1000)", "primaryKey": false, "notNull": false }, "icon": { "name": "icon", "type": "varchar(100)", "primaryKey": false, "notNull": false }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "view_config": { "name": "view_config", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "bookmarks_organization_id_organizations_id_fk": { "name": "bookmarks_organization_id_organizations_id_fk", "tableFrom": "bookmarks", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bookmarks_user_id_users_id_fk": { "name": "bookmarks_user_id_users_id_fk", "tableFrom": "bookmarks", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bookmarks_folder_id_bookmark_folders_id_fk": { "name": "bookmarks_folder_id_bookmark_folders_id_fk", "tableFrom": "bookmarks", "tableTo": "bookmark_folders", "columnsFrom": [ "folder_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bookmarks_form_id_forms_id_fk": { "name": "bookmarks_form_id_forms_id_fk", "tableFrom": "bookmarks", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "bookmarks_created_by_users_id_fk": { "name": "bookmarks_created_by_users_id_fk", "tableFrom": "bookmarks", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.bot_sessions": { "name": "bot_sessions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "bot_id": { "name": "bot_id", "type": "integer", "primaryKey": false, "notNull": true }, "refresh_token": { "name": "refresh_token", "type": "varchar(500)", "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": false, "default": "now()" }, "ip_address": { "name": "ip_address", "type": "varchar(45)", "primaryKey": false, "notNull": false }, "user_agent": { "name": "user_agent", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "bot_sessions_bot_id_bots_id_fk": { "name": "bot_sessions_bot_id_bots_id_fk", "tableFrom": "bot_sessions", "tableTo": "bots", "columnsFrom": [ "bot_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "bot_sessions_refresh_token_unique": { "name": "bot_sessions_refresh_token_unique", "nullsNotDistinct": false, "columns": [ "refresh_token" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.bot_subscriptions": { "name": "bot_subscriptions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "bot_id": { "name": "bot_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "subscription_type": { "name": "subscription_type", "type": "varchar(20)", "primaryKey": false, "notNull": true }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": false }, "status_id": { "name": "status_id", "type": "integer", "primaryKey": false, "notNull": false }, "transition_id": { "name": "transition_id", "type": "integer", "primaryKey": false, "notNull": false }, "events": { "name": "events", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'[\"comment\",\"field_change\",\"status_change\"]'::jsonb" }, "filters": { "name": "filters", "type": "jsonb", "primaryKey": false, "notNull": false }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "bot_subscriptions_bot_id_bots_id_fk": { "name": "bot_subscriptions_bot_id_bots_id_fk", "tableFrom": "bot_subscriptions", "tableTo": "bots", "columnsFrom": [ "bot_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bot_subscriptions_organization_id_organizations_id_fk": { "name": "bot_subscriptions_organization_id_organizations_id_fk", "tableFrom": "bot_subscriptions", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bot_subscriptions_form_id_forms_id_fk": { "name": "bot_subscriptions_form_id_forms_id_fk", "tableFrom": "bot_subscriptions", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bot_subscriptions_status_id_form_statuses_id_fk": { "name": "bot_subscriptions_status_id_form_statuses_id_fk", "tableFrom": "bot_subscriptions", "tableTo": "form_statuses", "columnsFrom": [ "status_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bot_subscriptions_transition_id_status_transitions_id_fk": { "name": "bot_subscriptions_transition_id_status_transitions_id_fk", "tableFrom": "bot_subscriptions", "tableTo": "status_transitions", "columnsFrom": [ "transition_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.bots": { "name": "bots", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "avatar_url": { "name": "avatar_url", "type": "varchar(500)", "primaryKey": false, "notNull": false }, "login": { "name": "login", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "password_hash": { "name": "password_hash", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "webhook_url": { "name": "webhook_url", "type": "varchar(1000)", "primaryKey": false, "notNull": false }, "webhook_secret": { "name": "webhook_secret", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "webhook_enabled": { "name": "webhook_enabled", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "bots_organization_id_organizations_id_fk": { "name": "bots_organization_id_organizations_id_fk", "tableFrom": "bots", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bots_created_by_users_id_fk": { "name": "bots_created_by_users_id_fk", "tableFrom": "bots", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "bots_organization_id_login_unique": { "name": "bots_organization_id_login_unique", "nullsNotDistinct": false, "columns": [ "organization_id", "login" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.conversation_members": { "name": "conversation_members", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "conversation_id": { "name": "conversation_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "joined_at": { "name": "joined_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "last_read_at": { "name": "last_read_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "external_org_id": { "name": "external_org_id", "type": "integer", "primaryKey": false, "notNull": false } }, "indexes": { "conversation_members_conv_idx": { "name": "conversation_members_conv_idx", "columns": [ { "expression": "conversation_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "conversation_members_user_idx": { "name": "conversation_members_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "conversation_members_conversation_id_conversations_id_fk": { "name": "conversation_members_conversation_id_conversations_id_fk", "tableFrom": "conversation_members", "tableTo": "conversations", "columnsFrom": [ "conversation_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "conversation_members_user_id_users_id_fk": { "name": "conversation_members_user_id_users_id_fk", "tableFrom": "conversation_members", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "conversation_members_conv_user_key": { "name": "conversation_members_conv_user_key", "nullsNotDistinct": false, "columns": [ "conversation_id", "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.conversation_messages": { "name": "conversation_messages", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "conversation_id": { "name": "conversation_id", "type": "integer", "primaryKey": false, "notNull": true }, "author_id": { "name": "author_id", "type": "integer", "primaryKey": false, "notNull": true }, "message": { "name": "message", "type": "text", "primaryKey": false, "notNull": true, "default": "''" }, "reply_to_id": { "name": "reply_to_id", "type": "integer", "primaryKey": false, "notNull": false }, "mentioned_user_ids": { "name": "mentioned_user_ids", "type": "jsonb", "primaryKey": false, "notNull": false }, "attachments": { "name": "attachments", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "is_deleted": { "name": "is_deleted", "type": "boolean", "primaryKey": false, "notNull": false, "default": false } }, "indexes": { "conv_messages_conv_created_idx": { "name": "conv_messages_conv_created_idx", "columns": [ { "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": { "conversation_messages_conversation_id_conversations_id_fk": { "name": "conversation_messages_conversation_id_conversations_id_fk", "tableFrom": "conversation_messages", "tableTo": "conversations", "columnsFrom": [ "conversation_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "conversation_messages_author_id_users_id_fk": { "name": "conversation_messages_author_id_users_id_fk", "tableFrom": "conversation_messages", "tableTo": "users", "columnsFrom": [ "author_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.conversations": { "name": "conversations", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(10)", "primaryKey": false, "notNull": true, "default": "'direct'" }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "is_default": { "name": "is_default", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "conversations_org_idx": { "name": "conversations_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "conversations_organization_id_organizations_id_fk": { "name": "conversations_organization_id_organizations_id_fk", "tableFrom": "conversations", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "conversations_created_by_users_id_fk": { "name": "conversations_created_by_users_id_fk", "tableFrom": "conversations", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.custom_pages": { "name": "custom_pages", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "slug": { "name": "slug", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "code": { "name": "code", "type": "text", "primaryKey": false, "notNull": true, "default": "''" }, "form_ids": { "name": "form_ids", "type": "integer[]", "primaryKey": false, "notNull": false, "default": "'{}'" }, "icon": { "name": "icon", "type": "varchar(50)", "primaryKey": false, "notNull": false, "default": "'FileCode'" }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "show_in_sidebar": { "name": "show_in_sidebar", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "custom_pages_org_idx": { "name": "custom_pages_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "custom_pages_organization_id_organizations_id_fk": { "name": "custom_pages_organization_id_organizations_id_fk", "tableFrom": "custom_pages", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "custom_pages_created_by_users_id_fk": { "name": "custom_pages_created_by_users_id_fk", "tableFrom": "custom_pages", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "custom_pages_org_slug_unique": { "name": "custom_pages_org_slug_unique", "nullsNotDistinct": false, "columns": [ "organization_id", "slug" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.custom_tab_modules": { "name": "custom_tab_modules", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "label": { "name": "label", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "icon": { "name": "icon", "type": "varchar(50)", "primaryKey": false, "notNull": false, "default": "'Puzzle'" }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "config": { "name": "config", "type": "jsonb", "primaryKey": false, "notNull": true }, "input_schema": { "name": "input_schema", "type": "jsonb", "primaryKey": false, "notNull": false }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "custom_tab_modules_org_idx": { "name": "custom_tab_modules_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "custom_tab_modules_organization_id_organizations_id_fk": { "name": "custom_tab_modules_organization_id_organizations_id_fk", "tableFrom": "custom_tab_modules", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "custom_tab_modules_created_by_users_id_fk": { "name": "custom_tab_modules_created_by_users_id_fk", "tableFrom": "custom_tab_modules", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "custom_tab_modules_organization_id_type_key": { "name": "custom_tab_modules_organization_id_type_key", "nullsNotDistinct": false, "columns": [ "organization_id", "type" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.data_table_permissions": { "name": "data_table_permissions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "table_id": { "name": "table_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "role": { "name": "role", "type": "varchar(20)", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "data_table_permissions_table_id_data_tables_id_fk": { "name": "data_table_permissions_table_id_data_tables_id_fk", "tableFrom": "data_table_permissions", "tableTo": "data_tables", "columnsFrom": [ "table_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "data_table_permissions_user_id_users_id_fk": { "name": "data_table_permissions_user_id_users_id_fk", "tableFrom": "data_table_permissions", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "data_table_permissions_table_id_user_id_unique": { "name": "data_table_permissions_table_id_user_id_unique", "nullsNotDistinct": false, "columns": [ "table_id", "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.data_table_rows": { "name": "data_table_rows", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "table_id": { "name": "table_id", "type": "integer", "primaryKey": false, "notNull": true }, "values": { "name": "values", "type": "jsonb", "primaryKey": false, "notNull": true }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "is_deleted": { "name": "is_deleted", "type": "boolean", "primaryKey": false, "notNull": false, "default": false } }, "indexes": {}, "foreignKeys": { "data_table_rows_table_id_data_tables_id_fk": { "name": "data_table_rows_table_id_data_tables_id_fk", "tableFrom": "data_table_rows", "tableTo": "data_tables", "columnsFrom": [ "table_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.data_tables": { "name": "data_tables", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "columns": { "name": "columns", "type": "jsonb", "primaryKey": false, "notNull": true }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "is_deleted": { "name": "is_deleted", "type": "boolean", "primaryKey": false, "notNull": false, "default": false } }, "indexes": {}, "foreignKeys": { "data_tables_organization_id_organizations_id_fk": { "name": "data_tables_organization_id_organizations_id_fk", "tableFrom": "data_tables", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "data_tables_created_by_users_id_fk": { "name": "data_tables_created_by_users_id_fk", "tableFrom": "data_tables", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.device_tokens": { "name": "device_tokens", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true }, "platform": { "name": "platform", "type": "varchar(20)", "primaryKey": false, "notNull": true }, "device_info": { "name": "device_info", "type": "jsonb", "primaryKey": false, "notNull": false }, "last_active_at": { "name": "last_active_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "device_tokens_user_idx": { "name": "device_tokens_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "device_tokens_token_idx": { "name": "device_tokens_token_idx", "columns": [ { "expression": "token", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "device_tokens_org_idx": { "name": "device_tokens_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "device_tokens_user_id_users_id_fk": { "name": "device_tokens_user_id_users_id_fk", "tableFrom": "device_tokens", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "device_tokens_organization_id_organizations_id_fk": { "name": "device_tokens_organization_id_organizations_id_fk", "tableFrom": "device_tokens", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "device_tokens_user_id_token_key": { "name": "device_tokens_user_id_token_key", "nullsNotDistinct": false, "columns": [ "user_id", "token" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.external_services": { "name": "external_services", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "service_type": { "name": "service_type", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "service_name": { "name": "service_name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "api_key": { "name": "api_key", "type": "text", "primaryKey": false, "notNull": false }, "secret_key": { "name": "secret_key", "type": "text", "primaryKey": false, "notNull": false }, "config": { "name": "config", "type": "jsonb", "primaryKey": false, "notNull": false }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "external_services_org_idx": { "name": "external_services_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "is_active", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "external_services_organization_id_organizations_id_fk": { "name": "external_services_organization_id_organizations_id_fk", "tableFrom": "external_services", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "external_services_organization_id_service_type_key": { "name": "external_services_organization_id_service_type_key", "nullsNotDistinct": false, "columns": [ "organization_id", "service_type" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.field_history": { "name": "field_history", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "field_id": { "name": "field_id", "type": "integer", "primaryKey": false, "notNull": true }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": true }, "old_value": { "name": "old_value", "type": "jsonb", "primaryKey": false, "notNull": false }, "new_value": { "name": "new_value", "type": "jsonb", "primaryKey": false, "notNull": false }, "changed_by": { "name": "changed_by", "type": "integer", "primaryKey": false, "notNull": true }, "changed_at": { "name": "changed_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "field_history_task_id_tasks_id_fk": { "name": "field_history_task_id_tasks_id_fk", "tableFrom": "field_history", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "field_history_field_id_form_fields_id_fk": { "name": "field_history_field_id_form_fields_id_fk", "tableFrom": "field_history", "tableTo": "form_fields", "columnsFrom": [ "field_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "field_history_form_id_forms_id_fk": { "name": "field_history_form_id_forms_id_fk", "tableFrom": "field_history", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "field_history_changed_by_users_id_fk": { "name": "field_history_changed_by_users_id_fk", "tableFrom": "field_history", "tableTo": "users", "columnsFrom": [ "changed_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "fk_field_history_task_same_form": { "name": "fk_field_history_task_same_form", "tableFrom": "field_history", "tableTo": "tasks", "columnsFrom": [ "task_id", "form_id" ], "columnsTo": [ "id", "form_id" ], "onDelete": "no action", "onUpdate": "no action" }, "fk_field_history_field_same_form": { "name": "fk_field_history_field_same_form", "tableFrom": "field_history", "tableTo": "form_fields", "columnsFrom": [ "field_id", "form_id" ], "columnsTo": [ "id", "form_id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.form_fields": { "name": "form_fields", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": true }, "tab_id": { "name": "tab_id", "type": "integer", "primaryKey": false, "notNull": false }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "code": { "name": "code", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "is_required": { "name": "is_required", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "placeholder": { "name": "placeholder", "type": "text", "primaryKey": false, "notNull": false }, "default_value": { "name": "default_value", "type": "text", "primaryKey": false, "notNull": false }, "validation_rules": { "name": "validation_rules", "type": "jsonb", "primaryKey": false, "notNull": false }, "options": { "name": "options", "type": "jsonb", "primaryKey": false, "notNull": false }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "linked_form_id": { "name": "linked_form_id", "type": "integer", "primaryKey": false, "notNull": false }, "button_action_type": { "name": "button_action_type", "type": "varchar(20)", "primaryKey": false, "notNull": false }, "button_url": { "name": "button_url", "type": "text", "primaryKey": false, "notNull": false }, "button_form_id": { "name": "button_form_id", "type": "integer", "primaryKey": false, "notNull": false }, "company_autofill": { "name": "company_autofill", "type": "jsonb", "primaryKey": false, "notNull": false }, "task_relation_type": { "name": "task_relation_type", "type": "varchar(10)", "primaryKey": false, "notNull": false }, "max_file_count": { "name": "max_file_count", "type": "integer", "primaryKey": false, "notNull": false }, "max_file_size_mb": { "name": "max_file_size_mb", "type": "integer", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "form_fields_form_id_forms_id_fk": { "name": "form_fields_form_id_forms_id_fk", "tableFrom": "form_fields", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "form_fields_tab_id_form_tabs_id_fk": { "name": "form_fields_tab_id_form_tabs_id_fk", "tableFrom": "form_fields", "tableTo": "form_tabs", "columnsFrom": [ "tab_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "form_fields_linked_form_id_forms_id_fk": { "name": "form_fields_linked_form_id_forms_id_fk", "tableFrom": "form_fields", "tableTo": "forms", "columnsFrom": [ "linked_form_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "form_fields_button_form_id_forms_id_fk": { "name": "form_fields_button_form_id_forms_id_fk", "tableFrom": "form_fields", "tableTo": "forms", "columnsFrom": [ "button_form_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "form_fields_form_id_code_unique": { "name": "form_fields_form_id_code_unique", "nullsNotDistinct": false, "columns": [ "form_id", "code" ] }, "form_fields_id_form_id_unique": { "name": "form_fields_id_form_id_unique", "nullsNotDistinct": false, "columns": [ "id", "form_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.form_statuses": { "name": "form_statuses", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "color": { "name": "color", "type": "varchar(7)", "primaryKey": false, "notNull": true, "default": "'#e5e7eb'" }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "is_initial": { "name": "is_initial", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "is_final": { "name": "is_final", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "one_initial_status_per_form": { "name": "one_initial_status_per_form", "columns": [ { "expression": "form_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "where": "\"form_statuses\".\"is_initial\" = true", "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "form_statuses_form_id_forms_id_fk": { "name": "form_statuses_form_id_forms_id_fk", "tableFrom": "form_statuses", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "form_statuses_id_form_id_unique": { "name": "form_statuses_id_form_id_unique", "nullsNotDistinct": false, "columns": [ "id", "form_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.form_tabs": { "name": "form_tabs", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "code": { "name": "code", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(20)", "primaryKey": false, "notNull": true, "default": "'fields'" }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "table_columns": { "name": "table_columns", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "form_tabs_form_id_forms_id_fk": { "name": "form_tabs_form_id_forms_id_fk", "tableFrom": "form_tabs", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "form_tabs_form_id_code_unique": { "name": "form_tabs_form_id_code_unique", "nullsNotDistinct": false, "columns": [ "form_id", "code" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.forms": { "name": "forms", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "chat_layout": { "name": "chat_layout", "type": "varchar(20)", "primaryKey": false, "notNull": false, "default": "'default'" }, "chat_enabled": { "name": "chat_enabled", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "system_fields_tab_id": { "name": "system_fields_tab_id", "type": "integer", "primaryKey": false, "notNull": false }, "default_tab_id": { "name": "default_tab_id", "type": "integer", "primaryKey": false, "notNull": false }, "detail_layout_code": { "name": "detail_layout_code", "type": "text", "primaryKey": false, "notNull": false }, "title_template": { "name": "title_template", "type": "text", "primaryKey": false, "notNull": false }, "hidden_system_fields": { "name": "hidden_system_fields", "type": "text[]", "primaryKey": false, "notNull": false, "default": "'{}'::text[]" }, "ai_summary": { "name": "ai_summary", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "forms_organization_id_organizations_id_fk": { "name": "forms_organization_id_organizations_id_fk", "tableFrom": "forms", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "forms_created_by_users_id_fk": { "name": "forms_created_by_users_id_fk", "tableFrom": "forms", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.global_fields": { "name": "global_fields", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "code": { "name": "code", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "options": { "name": "options", "type": "jsonb", "primaryKey": false, "notNull": false }, "default_value": { "name": "default_value", "type": "text", "primaryKey": false, "notNull": false }, "is_required": { "name": "is_required", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "placeholder": { "name": "placeholder", "type": "text", "primaryKey": false, "notNull": false }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "validation_rules": { "name": "validation_rules", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "global_fields_org_idx": { "name": "global_fields_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "global_fields_organization_id_organizations_id_fk": { "name": "global_fields_organization_id_organizations_id_fk", "tableFrom": "global_fields", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "global_fields_created_by_users_id_fk": { "name": "global_fields_created_by_users_id_fk", "tableFrom": "global_fields", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "global_fields_organization_id_code_key": { "name": "global_fields_organization_id_code_key", "nullsNotDistinct": false, "columns": [ "organization_id", "code" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.invitations": { "name": "invitations", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "email": { "name": "email", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "token": { "name": "token", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "expires_at": { "name": "expires_at", "type": "timestamp", "primaryKey": false, "notNull": true }, "used_at": { "name": "used_at", "type": "timestamp", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "invitations_organization_id_organizations_id_fk": { "name": "invitations_organization_id_organizations_id_fk", "tableFrom": "invitations", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "invitations_created_by_users_id_fk": { "name": "invitations_created_by_users_id_fk", "tableFrom": "invitations", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "invitations_token_key": { "name": "invitations_token_key", "nullsNotDistinct": false, "columns": [ "token" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.message_reactions": { "name": "message_reactions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_message_id": { "name": "task_message_id", "type": "integer", "primaryKey": false, "notNull": false }, "conv_message_id": { "name": "conv_message_id", "type": "integer", "primaryKey": false, "notNull": false }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "emoji": { "name": "emoji", "type": "varchar(10)", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "mr_task_msg_idx": { "name": "mr_task_msg_idx", "columns": [ { "expression": "task_message_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "mr_conv_msg_idx": { "name": "mr_conv_msg_idx", "columns": [ { "expression": "conv_message_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "message_reactions_task_message_id_task_messages_id_fk": { "name": "message_reactions_task_message_id_task_messages_id_fk", "tableFrom": "message_reactions", "tableTo": "task_messages", "columnsFrom": [ "task_message_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "message_reactions_conv_message_id_conversation_messages_id_fk": { "name": "message_reactions_conv_message_id_conversation_messages_id_fk", "tableFrom": "message_reactions", "tableTo": "conversation_messages", "columnsFrom": [ "conv_message_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "message_reactions_user_id_users_id_fk": { "name": "message_reactions_user_id_users_id_fk", "tableFrom": "message_reactions", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "message_reactions_organization_id_organizations_id_fk": { "name": "message_reactions_organization_id_organizations_id_fk", "tableFrom": "message_reactions", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "mr_task_user_emoji_key": { "name": "mr_task_user_emoji_key", "nullsNotDistinct": false, "columns": [ "task_message_id", "user_id", "emoji" ] }, "mr_conv_user_emoji_key": { "name": "mr_conv_user_emoji_key", "nullsNotDistinct": false, "columns": [ "conv_message_id", "user_id", "emoji" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.message_reads": { "name": "message_reads", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "message_id": { "name": "message_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "read_at": { "name": "read_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "message_reads_user_org_idx": { "name": "message_reads_user_org_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "message_reads_message_org_idx": { "name": "message_reads_message_org_idx", "columns": [ { "expression": "message_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "message_reads_message_id_task_messages_id_fk": { "name": "message_reads_message_id_task_messages_id_fk", "tableFrom": "message_reads", "tableTo": "task_messages", "columnsFrom": [ "message_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "message_reads_user_id_users_id_fk": { "name": "message_reads_user_id_users_id_fk", "tableFrom": "message_reads", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "message_reads_organization_id_organizations_id_fk": { "name": "message_reads_organization_id_organizations_id_fk", "tableFrom": "message_reads", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "message_reads_unique": { "name": "message_reads_unique", "nullsNotDistinct": false, "columns": [ "message_id", "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.notification_event_types": { "name": "notification_event_types", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "code": { "name": "code", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "category": { "name": "category", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "notification_event_types_code_unique": { "name": "notification_event_types_code_unique", "nullsNotDistinct": false, "columns": [ "code" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.notification_subscriptions": { "name": "notification_subscriptions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "event_type_code": { "name": "event_type_code", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "target_type": { "name": "target_type", "type": "varchar(50)", "primaryKey": false, "notNull": false }, "target_id": { "name": "target_id", "type": "integer", "primaryKey": false, "notNull": false }, "channels": { "name": "channels", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[\"app\", \"email\"]'::jsonb" }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "notification_subs_user_idx": { "name": "notification_subs_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "notification_subs_event_idx": { "name": "notification_subs_event_idx", "columns": [ { "expression": "event_type_code", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "is_active", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "notification_subscriptions_user_id_users_id_fk": { "name": "notification_subscriptions_user_id_users_id_fk", "tableFrom": "notification_subscriptions", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "notification_subscriptions_organization_id_organizations_id_fk": { "name": "notification_subscriptions_organization_id_organizations_id_fk", "tableFrom": "notification_subscriptions", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "notification_subscriptions_user_id_event_type_code_target_type_": { "name": "notification_subscriptions_user_id_event_type_code_target_type_", "nullsNotDistinct": false, "columns": [ "user_id", "event_type_code", "target_type", "target_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.org_connections": { "name": "org_connections", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "initiator_org_id": { "name": "initiator_org_id", "type": "integer", "primaryKey": false, "notNull": true }, "partner_org_id": { "name": "partner_org_id", "type": "integer", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "varchar(20)", "primaryKey": false, "notNull": true, "default": "'pending'" }, "token": { "name": "token", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "accepted_at": { "name": "accepted_at", "type": "timestamp", "primaryKey": false, "notNull": false } }, "indexes": { "org_connections_initiator_idx": { "name": "org_connections_initiator_idx", "columns": [ { "expression": "initiator_org_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "org_connections_partner_idx": { "name": "org_connections_partner_idx", "columns": [ { "expression": "partner_org_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "org_connections_token_idx": { "name": "org_connections_token_idx", "columns": [ { "expression": "token", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "org_connections_initiator_org_id_organizations_id_fk": { "name": "org_connections_initiator_org_id_organizations_id_fk", "tableFrom": "org_connections", "tableTo": "organizations", "columnsFrom": [ "initiator_org_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "org_connections_partner_org_id_organizations_id_fk": { "name": "org_connections_partner_org_id_organizations_id_fk", "tableFrom": "org_connections", "tableTo": "organizations", "columnsFrom": [ "partner_org_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "org_connections_token_unique": { "name": "org_connections_token_unique", "nullsNotDistinct": false, "columns": [ "token" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.organization_api_keys": { "name": "organization_api_keys", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "key_hash": { "name": "key_hash", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "key_prefix": { "name": "key_prefix", "type": "varchar(16)", "primaryKey": false, "notNull": true }, "label": { "name": "label", "type": "varchar(100)", "primaryKey": false, "notNull": true, "default": "'Default'" }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "last_used_at": { "name": "last_used_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": true, "default": true } }, "indexes": { "api_keys_org_idx": { "name": "api_keys_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "api_keys_hash_idx": { "name": "api_keys_hash_idx", "columns": [ { "expression": "key_hash", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "organization_api_keys_organization_id_organizations_id_fk": { "name": "organization_api_keys_organization_id_organizations_id_fk", "tableFrom": "organization_api_keys", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "organization_api_keys_created_by_users_id_fk": { "name": "organization_api_keys_created_by_users_id_fk", "tableFrom": "organization_api_keys", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "organization_api_keys_key_hash_key": { "name": "organization_api_keys_key_hash_key", "nullsNotDistinct": false, "columns": [ "key_hash" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.organization_billing": { "name": "organization_billing", "schema": "", "columns": { "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": true, "notNull": true }, "price_per_user": { "name": "price_per_user", "type": "numeric(10, 2)", "primaryKey": false, "notNull": true, "default": "'0'" }, "balance": { "name": "balance", "type": "numeric(10, 2)", "primaryKey": false, "notNull": true, "default": "'0'" }, "currency": { "name": "currency", "type": "varchar(10)", "primaryKey": false, "notNull": true, "default": "'RUB'" }, "next_billing_date": { "name": "next_billing_date", "type": "date", "primaryKey": false, "notNull": false }, "blocked_at": { "name": "blocked_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "organization_billing_organization_id_organizations_id_fk": { "name": "organization_billing_organization_id_organizations_id_fk", "tableFrom": "organization_billing", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.organizations": { "name": "organizations", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "name": { "name": "name", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "slug": { "name": "slug", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "display_name": { "name": "display_name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "logo_url": { "name": "logo_url", "type": "varchar(500)", "primaryKey": false, "notNull": false }, "theme_color": { "name": "theme_color", "type": "varchar(7)", "primaryKey": false, "notNull": false, "default": "'#1976d2'" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "billing_blocked": { "name": "billing_blocked", "type": "boolean", "primaryKey": false, "notNull": false, "default": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "organizations_name_unique": { "name": "organizations_name_unique", "nullsNotDistinct": false, "columns": [ "name" ] }, "organizations_slug_unique": { "name": "organizations_slug_unique", "nullsNotDistinct": false, "columns": [ "slug" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.poll_votes": { "name": "poll_votes", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "poll_id": { "name": "poll_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "option_indexes": { "name": "option_indexes", "type": "integer[]", "primaryKey": false, "notNull": true, "default": "'{}'" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "poll_votes_poll_idx": { "name": "poll_votes_poll_idx", "columns": [ { "expression": "poll_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "poll_votes_poll_id_polls_id_fk": { "name": "poll_votes_poll_id_polls_id_fk", "tableFrom": "poll_votes", "tableTo": "polls", "columnsFrom": [ "poll_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "poll_votes_user_id_users_id_fk": { "name": "poll_votes_user_id_users_id_fk", "tableFrom": "poll_votes", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "poll_votes_poll_user_key": { "name": "poll_votes_poll_user_key", "nullsNotDistinct": false, "columns": [ "poll_id", "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.polls": { "name": "polls", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_message_id": { "name": "task_message_id", "type": "integer", "primaryKey": false, "notNull": false }, "conv_message_id": { "name": "conv_message_id", "type": "integer", "primaryKey": false, "notNull": false }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "question": { "name": "question", "type": "text", "primaryKey": false, "notNull": true }, "options": { "name": "options", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'[]'::jsonb" }, "is_multiple": { "name": "is_multiple", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "is_closed": { "name": "is_closed", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "polls_org_idx": { "name": "polls_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "polls_task_message_id_task_messages_id_fk": { "name": "polls_task_message_id_task_messages_id_fk", "tableFrom": "polls", "tableTo": "task_messages", "columnsFrom": [ "task_message_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "polls_conv_message_id_conversation_messages_id_fk": { "name": "polls_conv_message_id_conversation_messages_id_fk", "tableFrom": "polls", "tableTo": "conversation_messages", "columnsFrom": [ "conv_message_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "polls_organization_id_organizations_id_fk": { "name": "polls_organization_id_organizations_id_fk", "tableFrom": "polls", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "polls_created_by_users_id_fk": { "name": "polls_created_by_users_id_fk", "tableFrom": "polls", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.rag_embeddings": { "name": "rag_embeddings", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "entity_type": { "name": "entity_type", "type": "varchar(20)", "primaryKey": false, "notNull": true }, "entity_id": { "name": "entity_id", "type": "integer", "primaryKey": false, "notNull": true }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": true }, "embedding": { "name": "embedding", "type": "vector(1536)", "primaryKey": false, "notNull": false }, "metadata": { "name": "metadata", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'{}'::jsonb" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "rag_embeddings_org_type_idx": { "name": "rag_embeddings_org_type_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "entity_type", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "rag_embeddings_organization_id_organizations_id_fk": { "name": "rag_embeddings_organization_id_organizations_id_fk", "tableFrom": "rag_embeddings", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "rag_embeddings_org_entity_type_id_key": { "name": "rag_embeddings_org_entity_type_id_key", "nullsNotDistinct": false, "columns": [ "organization_id", "entity_type", "entity_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.regular_table_rows": { "name": "regular_table_rows", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "tab_id": { "name": "tab_id", "type": "integer", "primaryKey": false, "notNull": true }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "data": { "name": "data", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_by": { "name": "updated_by", "type": "integer", "primaryKey": false, "notNull": false }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "regular_table_rows_task_tab_idx": { "name": "regular_table_rows_task_tab_idx", "columns": [ { "expression": "task_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "tab_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "regular_table_rows_task_id_tasks_id_fk": { "name": "regular_table_rows_task_id_tasks_id_fk", "tableFrom": "regular_table_rows", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "regular_table_rows_tab_id_form_tabs_id_fk": { "name": "regular_table_rows_tab_id_form_tabs_id_fk", "tableFrom": "regular_table_rows", "tableTo": "form_tabs", "columnsFrom": [ "tab_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "regular_table_rows_created_by_users_id_fk": { "name": "regular_table_rows_created_by_users_id_fk", "tableFrom": "regular_table_rows", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "regular_table_rows_updated_by_users_id_fk": { "name": "regular_table_rows_updated_by_users_id_fk", "tableFrom": "regular_table_rows", "tableTo": "users", "columnsFrom": [ "updated_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.role_members": { "name": "role_members", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "role_id": { "name": "role_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "role_members_role_idx": { "name": "role_members_role_idx", "columns": [ { "expression": "role_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "role_members_user_idx": { "name": "role_members_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "role_members_role_id_roles_id_fk": { "name": "role_members_role_id_roles_id_fk", "tableFrom": "role_members", "tableTo": "roles", "columnsFrom": [ "role_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "role_members_user_id_users_id_fk": { "name": "role_members_user_id_users_id_fk", "tableFrom": "role_members", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "role_members_role_user_key": { "name": "role_members_role_user_key", "nullsNotDistinct": false, "columns": [ "role_id", "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.roles": { "name": "roles", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "parent_id": { "name": "parent_id", "type": "integer", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "roles_org_idx": { "name": "roles_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "roles_parent_idx": { "name": "roles_parent_idx", "columns": [ { "expression": "parent_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "roles_organization_id_organizations_id_fk": { "name": "roles_organization_id_organizations_id_fk", "tableFrom": "roles", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.status_transitions": { "name": "status_transitions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": true }, "from_status_id": { "name": "from_status_id", "type": "integer", "primaryKey": false, "notNull": true }, "to_status_id": { "name": "to_status_id", "type": "integer", "primaryKey": false, "notNull": true }, "reject_to_status_id": { "name": "reject_to_status_id", "type": "integer", "primaryKey": false, "notNull": false }, "action_type": { "name": "action_type", "type": "varchar(20)", "primaryKey": false, "notNull": true, "default": "'approve'" }, "action_name": { "name": "action_name", "type": "varchar(100)", "primaryKey": false, "notNull": false }, "conditions": { "name": "conditions", "type": "jsonb", "primaryKey": false, "notNull": false }, "required_role": { "name": "required_role", "type": "varchar(20)", "primaryKey": false, "notNull": false }, "assignee_user_id": { "name": "assignee_user_id", "type": "integer", "primaryKey": false, "notNull": false }, "assignee_conditions": { "name": "assignee_conditions", "type": "jsonb", "primaryKey": false, "notNull": false }, "approve_button_text": { "name": "approve_button_text", "type": "varchar(50)", "primaryKey": false, "notNull": false, "default": "'Одобрить'" }, "approve_button_color": { "name": "approve_button_color", "type": "varchar(7)", "primaryKey": false, "notNull": false, "default": "'#22c55e'" }, "reject_button_text": { "name": "reject_button_text", "type": "varchar(50)", "primaryKey": false, "notNull": false, "default": "'Отклонить'" }, "reject_button_color": { "name": "reject_button_color", "type": "varchar(7)", "primaryKey": false, "notNull": false, "default": "'#ef4444'" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "status_transitions_form_id_forms_id_fk": { "name": "status_transitions_form_id_forms_id_fk", "tableFrom": "status_transitions", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "status_transitions_from_status_id_form_statuses_id_fk": { "name": "status_transitions_from_status_id_form_statuses_id_fk", "tableFrom": "status_transitions", "tableTo": "form_statuses", "columnsFrom": [ "from_status_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "status_transitions_to_status_id_form_statuses_id_fk": { "name": "status_transitions_to_status_id_form_statuses_id_fk", "tableFrom": "status_transitions", "tableTo": "form_statuses", "columnsFrom": [ "to_status_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "status_transitions_reject_to_status_id_form_statuses_id_fk": { "name": "status_transitions_reject_to_status_id_form_statuses_id_fk", "tableFrom": "status_transitions", "tableTo": "form_statuses", "columnsFrom": [ "reject_to_status_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "status_transitions_assignee_user_id_users_id_fk": { "name": "status_transitions_assignee_user_id_users_id_fk", "tableFrom": "status_transitions", "tableTo": "users", "columnsFrom": [ "assignee_user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "fk_transition_from_status_same_form": { "name": "fk_transition_from_status_same_form", "tableFrom": "status_transitions", "tableTo": "form_statuses", "columnsFrom": [ "from_status_id", "form_id" ], "columnsTo": [ "id", "form_id" ], "onDelete": "no action", "onUpdate": "no action" }, "fk_transition_to_status_same_form": { "name": "fk_transition_to_status_same_form", "tableFrom": "status_transitions", "tableTo": "form_statuses", "columnsFrom": [ "to_status_id", "form_id" ], "columnsTo": [ "id", "form_id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.super_admins": { "name": "super_admins", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "email": { "name": "email", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "password_hash": { "name": "password_hash", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "last_login": { "name": "last_login", "type": "timestamp", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "super_admins_email_key": { "name": "super_admins_email_key", "nullsNotDistinct": false, "columns": [ "email" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.system_audit_log": { "name": "system_audit_log", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "action": { "name": "action", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": false }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": false }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": false }, "details": { "name": "details", "type": "jsonb", "primaryKey": false, "notNull": false }, "ip": { "name": "ip", "type": "varchar(45)", "primaryKey": false, "notNull": false }, "user_agent": { "name": "user_agent", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "system_audit_log_action_created_idx": { "name": "system_audit_log_action_created_idx", "columns": [ { "expression": "action", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "system_audit_log_org_created_idx": { "name": "system_audit_log_org_created_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "system_audit_log_user_id_users_id_fk": { "name": "system_audit_log_user_id_users_id_fk", "tableFrom": "system_audit_log", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "system_audit_log_organization_id_organizations_id_fk": { "name": "system_audit_log_organization_id_organizations_id_fk", "tableFrom": "system_audit_log", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_assignees": { "name": "task_assignees", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "task_assignees_task_idx": { "name": "task_assignees_task_idx", "columns": [ { "expression": "task_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "task_assignees_user_idx": { "name": "task_assignees_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "task_assignees_org_idx": { "name": "task_assignees_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "task_assignees_task_id_tasks_id_fk": { "name": "task_assignees_task_id_tasks_id_fk", "tableFrom": "task_assignees", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_assignees_user_id_users_id_fk": { "name": "task_assignees_user_id_users_id_fk", "tableFrom": "task_assignees", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_assignees_organization_id_organizations_id_fk": { "name": "task_assignees_organization_id_organizations_id_fk", "tableFrom": "task_assignees", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "task_assignees_task_user_key": { "name": "task_assignees_task_user_key", "nullsNotDistinct": false, "columns": [ "task_id", "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_audit_log": { "name": "task_audit_log", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "action": { "name": "action", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "field_id": { "name": "field_id", "type": "integer", "primaryKey": false, "notNull": false }, "field_name": { "name": "field_name", "type": "text", "primaryKey": false, "notNull": false }, "old_value": { "name": "old_value", "type": "jsonb", "primaryKey": false, "notNull": false }, "new_value": { "name": "new_value", "type": "jsonb", "primaryKey": false, "notNull": false }, "changed_by": { "name": "changed_by", "type": "integer", "primaryKey": false, "notNull": false }, "changed_by_name": { "name": "changed_by_name", "type": "text", "primaryKey": false, "notNull": false }, "metadata": { "name": "metadata", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "task_audit_log_task_created_idx": { "name": "task_audit_log_task_created_idx", "columns": [ { "expression": "task_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "task_audit_log_task_id_tasks_id_fk": { "name": "task_audit_log_task_id_tasks_id_fk", "tableFrom": "task_audit_log", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_audit_log_organization_id_organizations_id_fk": { "name": "task_audit_log_organization_id_organizations_id_fk", "tableFrom": "task_audit_log", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_audit_log_changed_by_users_id_fk": { "name": "task_audit_log_changed_by_users_id_fk", "tableFrom": "task_audit_log", "tableTo": "users", "columnsFrom": [ "changed_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_field_values": { "name": "task_field_values", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "field_id": { "name": "field_id", "type": "integer", "primaryKey": false, "notNull": true }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "task_field_values_task_field_idx": { "name": "task_field_values_task_field_idx", "columns": [ { "expression": "task_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "field_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "task_field_values_task_id_tasks_id_fk": { "name": "task_field_values_task_id_tasks_id_fk", "tableFrom": "task_field_values", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_field_values_field_id_form_fields_id_fk": { "name": "task_field_values_field_id_form_fields_id_fk", "tableFrom": "task_field_values", "tableTo": "form_fields", "columnsFrom": [ "field_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "task_field_values_form_id_forms_id_fk": { "name": "task_field_values_form_id_forms_id_fk", "tableFrom": "task_field_values", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "fk_task_field_value_task_same_form": { "name": "fk_task_field_value_task_same_form", "tableFrom": "task_field_values", "tableTo": "tasks", "columnsFrom": [ "task_id", "form_id" ], "columnsTo": [ "id", "form_id" ], "onDelete": "no action", "onUpdate": "no action" }, "fk_task_field_value_field_same_form": { "name": "fk_task_field_value_field_same_form", "tableFrom": "task_field_values", "tableTo": "form_fields", "columnsFrom": [ "field_id", "form_id" ], "columnsTo": [ "id", "form_id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "task_field_values_task_id_field_id_unique": { "name": "task_field_values_task_id_field_id_unique", "nullsNotDistinct": false, "columns": [ "task_id", "field_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_messages": { "name": "task_messages", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": true }, "author_id": { "name": "author_id", "type": "integer", "primaryKey": false, "notNull": false }, "bot_id": { "name": "bot_id", "type": "integer", "primaryKey": false, "notNull": false }, "reply_to_message_id": { "name": "reply_to_message_id", "type": "integer", "primaryKey": false, "notNull": false }, "message": { "name": "message", "type": "text", "primaryKey": false, "notNull": true, "default": "''" }, "message_type": { "name": "message_type", "type": "varchar(20)", "primaryKey": false, "notNull": true, "default": "'comment'" }, "mentioned_user_ids": { "name": "mentioned_user_ids", "type": "jsonb", "primaryKey": false, "notNull": false }, "bot_buttons": { "name": "bot_buttons", "type": "jsonb", "primaryKey": false, "notNull": false }, "attachments": { "name": "attachments", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "task_messages_task_created_idx": { "name": "task_messages_task_created_idx", "columns": [ { "expression": "task_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "task_messages_task_id_tasks_id_fk": { "name": "task_messages_task_id_tasks_id_fk", "tableFrom": "task_messages", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_messages_form_id_forms_id_fk": { "name": "task_messages_form_id_forms_id_fk", "tableFrom": "task_messages", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_messages_author_id_users_id_fk": { "name": "task_messages_author_id_users_id_fk", "tableFrom": "task_messages", "tableTo": "users", "columnsFrom": [ "author_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "task_messages_reply_to_message_id_task_messages_id_fk": { "name": "task_messages_reply_to_message_id_task_messages_id_fk", "tableFrom": "task_messages", "tableTo": "task_messages", "columnsFrom": [ "reply_to_message_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "fk_task_message_task_same_form": { "name": "fk_task_message_task_same_form", "tableFrom": "task_messages", "tableTo": "tasks", "columnsFrom": [ "task_id", "form_id" ], "columnsTo": [ "id", "form_id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_relations": { "name": "task_relations", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "parent_task_id": { "name": "parent_task_id", "type": "integer", "primaryKey": false, "notNull": true }, "child_task_id": { "name": "child_task_id", "type": "integer", "primaryKey": false, "notNull": true }, "field_id": { "name": "field_id", "type": "integer", "primaryKey": false, "notNull": false }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "task_relations_parent_task_id_tasks_id_fk": { "name": "task_relations_parent_task_id_tasks_id_fk", "tableFrom": "task_relations", "tableTo": "tasks", "columnsFrom": [ "parent_task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_relations_child_task_id_tasks_id_fk": { "name": "task_relations_child_task_id_tasks_id_fk", "tableFrom": "task_relations", "tableTo": "tasks", "columnsFrom": [ "child_task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_relations_field_id_form_fields_id_fk": { "name": "task_relations_field_id_form_fields_id_fk", "tableFrom": "task_relations", "tableTo": "form_fields", "columnsFrom": [ "field_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "task_relations_organization_id_organizations_id_fk": { "name": "task_relations_organization_id_organizations_id_fk", "tableFrom": "task_relations", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "task_relations_parent_task_id_child_task_id_field_id_key": { "name": "task_relations_parent_task_id_child_task_id_field_id_key", "nullsNotDistinct": false, "columns": [ "parent_task_id", "child_task_id", "field_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_reminders": { "name": "task_reminders", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "created_by_user_id": { "name": "created_by_user_id", "type": "integer", "primaryKey": false, "notNull": true }, "remind_at": { "name": "remind_at", "type": "timestamp", "primaryKey": false, "notNull": true }, "note": { "name": "note", "type": "text", "primaryKey": false, "notNull": false }, "recipients": { "name": "recipients", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'[]'::jsonb" }, "is_sent": { "name": "is_sent", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "task_reminders_task_id_tasks_id_fk": { "name": "task_reminders_task_id_tasks_id_fk", "tableFrom": "task_reminders", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_reminders_organization_id_organizations_id_fk": { "name": "task_reminders_organization_id_organizations_id_fk", "tableFrom": "task_reminders", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_reminders_created_by_user_id_users_id_fk": { "name": "task_reminders_created_by_user_id_users_id_fk", "tableFrom": "task_reminders", "tableTo": "users", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_roles": { "name": "task_roles", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "role_id": { "name": "role_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "task_roles_task_idx": { "name": "task_roles_task_idx", "columns": [ { "expression": "task_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "task_roles_role_idx": { "name": "task_roles_role_idx", "columns": [ { "expression": "role_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "task_roles_org_idx": { "name": "task_roles_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "task_roles_task_id_tasks_id_fk": { "name": "task_roles_task_id_tasks_id_fk", "tableFrom": "task_roles", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_roles_role_id_roles_id_fk": { "name": "task_roles_role_id_roles_id_fk", "tableFrom": "task_roles", "tableTo": "roles", "columnsFrom": [ "role_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_roles_organization_id_organizations_id_fk": { "name": "task_roles_organization_id_organizations_id_fk", "tableFrom": "task_roles", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "task_roles_task_role_key": { "name": "task_roles_task_role_key", "nullsNotDistinct": false, "columns": [ "task_id", "role_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_tab_values": { "name": "task_tab_values", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "tab_id": { "name": "tab_id", "type": "integer", "primaryKey": false, "notNull": true }, "values": { "name": "values", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{}'::jsonb" }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "task_tab_values_task_idx": { "name": "task_tab_values_task_idx", "columns": [ { "expression": "task_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "task_tab_values_tab_idx": { "name": "task_tab_values_tab_idx", "columns": [ { "expression": "tab_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "task_tab_values_task_id_tasks_id_fk": { "name": "task_tab_values_task_id_tasks_id_fk", "tableFrom": "task_tab_values", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_tab_values_tab_id_form_tabs_id_fk": { "name": "task_tab_values_tab_id_form_tabs_id_fk", "tableFrom": "task_tab_values", "tableTo": "form_tabs", "columnsFrom": [ "tab_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "task_tab_values_task_id_tab_id_key": { "name": "task_tab_values_task_id_tab_id_key", "nullsNotDistinct": false, "columns": [ "task_id", "tab_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_table_cell_history": { "name": "task_table_cell_history", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "cell_id": { "name": "cell_id", "type": "integer", "primaryKey": false, "notNull": true }, "table_id": { "name": "table_id", "type": "integer", "primaryKey": false, "notNull": true }, "row_index": { "name": "row_index", "type": "integer", "primaryKey": false, "notNull": true }, "col_index": { "name": "col_index", "type": "integer", "primaryKey": false, "notNull": true }, "prev_value": { "name": "prev_value", "type": "text", "primaryKey": false, "notNull": false }, "prev_formula": { "name": "prev_formula", "type": "text", "primaryKey": false, "notNull": false }, "new_value": { "name": "new_value", "type": "text", "primaryKey": false, "notNull": false }, "new_formula": { "name": "new_formula", "type": "text", "primaryKey": false, "notNull": false }, "changed_by": { "name": "changed_by", "type": "integer", "primaryKey": false, "notNull": false }, "changed_at": { "name": "changed_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "task_table_cell_history_cell_id_task_table_cells_id_fk": { "name": "task_table_cell_history_cell_id_task_table_cells_id_fk", "tableFrom": "task_table_cell_history", "tableTo": "task_table_cells", "columnsFrom": [ "cell_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_table_cell_history_table_id_task_tables_id_fk": { "name": "task_table_cell_history_table_id_task_tables_id_fk", "tableFrom": "task_table_cell_history", "tableTo": "task_tables", "columnsFrom": [ "table_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_table_cell_history_changed_by_users_id_fk": { "name": "task_table_cell_history_changed_by_users_id_fk", "tableFrom": "task_table_cell_history", "tableTo": "users", "columnsFrom": [ "changed_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_table_cells": { "name": "task_table_cells", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "table_id": { "name": "table_id", "type": "integer", "primaryKey": false, "notNull": true }, "row_index": { "name": "row_index", "type": "integer", "primaryKey": false, "notNull": true }, "col_index": { "name": "col_index", "type": "integer", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": false }, "formula": { "name": "formula", "type": "text", "primaryKey": false, "notNull": false }, "updated_by": { "name": "updated_by", "type": "integer", "primaryKey": false, "notNull": false }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "task_table_cells_table_id_task_tables_id_fk": { "name": "task_table_cells_table_id_task_tables_id_fk", "tableFrom": "task_table_cells", "tableTo": "task_tables", "columnsFrom": [ "table_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_table_cells_updated_by_users_id_fk": { "name": "task_table_cells_updated_by_users_id_fk", "tableFrom": "task_table_cells", "tableTo": "users", "columnsFrom": [ "updated_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "task_table_cells_table_id_row_index_col_index_key": { "name": "task_table_cells_table_id_row_index_col_index_key", "nullsNotDistinct": false, "columns": [ "table_id", "row_index", "col_index" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_tables": { "name": "task_tables", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "tab_id": { "name": "tab_id", "type": "integer", "primaryKey": false, "notNull": false }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "columns": { "name": "columns", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "task_tables_task_id_tasks_id_fk": { "name": "task_tables_task_id_tasks_id_fk", "tableFrom": "task_tables", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_tables_tab_id_form_tabs_id_fk": { "name": "task_tables_tab_id_form_tabs_id_fk", "tableFrom": "task_tables", "tableTo": "form_tabs", "columnsFrom": [ "tab_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_tables_created_by_users_id_fk": { "name": "task_tables_created_by_users_id_fk", "tableFrom": "task_tables", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.task_user_access": { "name": "task_user_access", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "granted_via": { "name": "granted_via", "type": "varchar(20)", "primaryKey": false, "notNull": true, "default": "'direct'" }, "role_id": { "name": "role_id", "type": "integer", "primaryKey": false, "notNull": false }, "first_interaction_at": { "name": "first_interaction_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "revoked_at": { "name": "revoked_at", "type": "timestamp", "primaryKey": false, "notNull": false } }, "indexes": { "task_user_access_task_idx": { "name": "task_user_access_task_idx", "columns": [ { "expression": "task_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "task_user_access_user_idx": { "name": "task_user_access_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "task_user_access_org_idx": { "name": "task_user_access_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "task_user_access_task_id_tasks_id_fk": { "name": "task_user_access_task_id_tasks_id_fk", "tableFrom": "task_user_access", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_user_access_user_id_users_id_fk": { "name": "task_user_access_user_id_users_id_fk", "tableFrom": "task_user_access", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "task_user_access_organization_id_organizations_id_fk": { "name": "task_user_access_organization_id_organizations_id_fk", "tableFrom": "task_user_access", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "task_user_access_task_user_key": { "name": "task_user_access_task_user_key", "nullsNotDistinct": false, "columns": [ "task_id", "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.tasks": { "name": "tasks", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": false }, "form_id": { "name": "form_id", "type": "integer", "primaryKey": false, "notNull": true }, "title": { "name": "title", "type": "varchar(500)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "current_status_id": { "name": "current_status_id", "type": "integer", "primaryKey": false, "notNull": true }, "assigned_to": { "name": "assigned_to", "type": "integer", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "completed_at": { "name": "completed_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "is_completed": { "name": "is_completed", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "due_date": { "name": "due_date", "type": "timestamp", "primaryKey": false, "notNull": false }, "parent_task_id": { "name": "parent_task_id", "type": "integer", "primaryKey": false, "notNull": false }, "depth": { "name": "depth", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 } }, "indexes": { "tasks_org_id_form_id_idx": { "name": "tasks_org_id_form_id_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "form_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "tasks_org_id_status_idx": { "name": "tasks_org_id_status_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "current_status_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "tasks_org_id_assigned_idx": { "name": "tasks_org_id_assigned_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "assigned_to", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "tasks_organization_id_organizations_id_fk": { "name": "tasks_organization_id_organizations_id_fk", "tableFrom": "tasks", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "tasks_form_id_forms_id_fk": { "name": "tasks_form_id_forms_id_fk", "tableFrom": "tasks", "tableTo": "forms", "columnsFrom": [ "form_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "tasks_current_status_id_form_statuses_id_fk": { "name": "tasks_current_status_id_form_statuses_id_fk", "tableFrom": "tasks", "tableTo": "form_statuses", "columnsFrom": [ "current_status_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "tasks_assigned_to_users_id_fk": { "name": "tasks_assigned_to_users_id_fk", "tableFrom": "tasks", "tableTo": "users", "columnsFrom": [ "assigned_to" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "tasks_created_by_users_id_fk": { "name": "tasks_created_by_users_id_fk", "tableFrom": "tasks", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "fk_task_status_same_form": { "name": "fk_task_status_same_form", "tableFrom": "tasks", "tableTo": "form_statuses", "columnsFrom": [ "current_status_id", "form_id" ], "columnsTo": [ "id", "form_id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "tasks_id_form_id_unique": { "name": "tasks_id_form_id_unique", "nullsNotDistinct": false, "columns": [ "id", "form_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user_custom_fields": { "name": "user_custom_fields", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "code": { "name": "code", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "options": { "name": "options", "type": "jsonb", "primaryKey": false, "notNull": false }, "is_required": { "name": "is_required", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "position": { "name": "position", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "user_custom_fields_organization_id_organizations_id_fk": { "name": "user_custom_fields_organization_id_organizations_id_fk", "tableFrom": "user_custom_fields", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user_custom_values": { "name": "user_custom_values", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "field_id": { "name": "field_id", "type": "integer", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "user_custom_values_user_id_users_id_fk": { "name": "user_custom_values_user_id_users_id_fk", "tableFrom": "user_custom_values", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "user_custom_values_field_id_user_custom_fields_id_fk": { "name": "user_custom_values_field_id_user_custom_fields_id_fk", "tableFrom": "user_custom_values", "tableTo": "user_custom_fields", "columnsFrom": [ "field_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user_notifications": { "name": "user_notifications", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "title": { "name": "title", "type": "varchar(200)", "primaryKey": false, "notNull": true }, "message": { "name": "message", "type": "text", "primaryKey": false, "notNull": true }, "task_id": { "name": "task_id", "type": "integer", "primaryKey": false, "notNull": false }, "message_id": { "name": "message_id", "type": "integer", "primaryKey": false, "notNull": false }, "is_read": { "name": "is_read", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "user_notifications_idx": { "name": "user_notifications_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "is_read", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "user_notifications_user_id_users_id_fk": { "name": "user_notifications_user_id_users_id_fk", "tableFrom": "user_notifications", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "user_notifications_organization_id_organizations_id_fk": { "name": "user_notifications_organization_id_organizations_id_fk", "tableFrom": "user_notifications", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "user_notifications_task_id_tasks_id_fk": { "name": "user_notifications_task_id_tasks_id_fk", "tableFrom": "user_notifications", "tableTo": "tasks", "columnsFrom": [ "task_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "user_notifications_message_id_task_messages_id_fk": { "name": "user_notifications_message_id_task_messages_id_fk", "tableFrom": "user_notifications", "tableTo": "task_messages", "columnsFrom": [ "message_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user_presence": { "name": "user_presence", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "is_online": { "name": "is_online", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "last_seen_at": { "name": "last_seen_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "active_devices": { "name": "active_devices", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 } }, "indexes": { "user_presence_user_idx": { "name": "user_presence_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "user_presence_online_idx": { "name": "user_presence_online_idx", "columns": [ { "expression": "is_online", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "user_presence_org_idx": { "name": "user_presence_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "user_presence_user_id_users_id_fk": { "name": "user_presence_user_id_users_id_fk", "tableFrom": "user_presence", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "user_presence_organization_id_organizations_id_fk": { "name": "user_presence_organization_id_organizations_id_fk", "tableFrom": "user_presence", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "user_presence_user_id_key": { "name": "user_presence_user_id_key", "nullsNotDistinct": false, "columns": [ "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user_sessions": { "name": "user_sessions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "refresh_token": { "name": "refresh_token", "type": "varchar(500)", "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": false, "default": "now()" }, "ip_address": { "name": "ip_address", "type": "varchar(45)", "primaryKey": false, "notNull": false }, "user_agent": { "name": "user_agent", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "user_sessions_user_id_users_id_fk": { "name": "user_sessions_user_id_users_id_fk", "tableFrom": "user_sessions", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "user_sessions_refresh_token_unique": { "name": "user_sessions_refresh_token_unique", "nullsNotDistinct": false, "columns": [ "refresh_token" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.users": { "name": "users", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "email": { "name": "email", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "password_hash": { "name": "password_hash", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "first_name": { "name": "first_name", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "last_name": { "name": "last_name", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "position": { "name": "position", "type": "varchar(200)", "primaryKey": false, "notNull": false }, "role": { "name": "role", "type": "varchar(20)", "primaryKey": false, "notNull": true, "default": "'user'" }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "email_verified": { "name": "email_verified", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "verification_token": { "name": "verification_token", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "reset_password_token": { "name": "reset_password_token", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "reset_password_expires": { "name": "reset_password_expires", "type": "timestamp", "primaryKey": false, "notNull": false }, "last_login": { "name": "last_login", "type": "timestamp", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "users_org_role_idx": { "name": "users_org_role_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "role", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "users_organization_id_organizations_id_fk": { "name": "users_organization_id_organizations_id_fk", "tableFrom": "users", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.web_push_subscriptions": { "name": "web_push_subscriptions", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true }, "organization_id": { "name": "organization_id", "type": "integer", "primaryKey": false, "notNull": true }, "endpoint": { "name": "endpoint", "type": "text", "primaryKey": false, "notNull": true }, "subscription": { "name": "subscription", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "web_push_user_idx": { "name": "web_push_user_idx", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "web_push_org_idx": { "name": "web_push_org_idx", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "web_push_endpoint_idx": { "name": "web_push_endpoint_idx", "columns": [ { "expression": "endpoint", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "web_push_subscriptions_user_id_users_id_fk": { "name": "web_push_subscriptions_user_id_users_id_fk", "tableFrom": "web_push_subscriptions", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "web_push_subscriptions_organization_id_organizations_id_fk": { "name": "web_push_subscriptions_organization_id_organizations_id_fk", "tableFrom": "web_push_subscriptions", "tableTo": "organizations", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "web_push_subscriptions_endpoint_key": { "name": "web_push_subscriptions_endpoint_key", "nullsNotDistinct": false, "columns": [ "endpoint" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false } }, "enums": {}, "schemas": {}, "sequences": {}, "roles": {}, "policies": {}, "views": {}, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }