ALTERTABLE`opencoze`.`node_execution`MODIFYCOLUMN`composite_node_index`bigintunsignedNULLCOMMENT"loop or batch_s execution index",MODIFYCOLUMN`parent_node_id`varchar(128)NULLCOMMENT"when as inner node for loop or batch, this is the parent node_s key"COLLATEutf8mb4_unicode_ci;
CREATETABLEIFNOTEXISTS`agent_to_database`(`id`bigintunsignedNOTNULLCOMMENT"ID",`agent_id`bigintunsignedNOTNULLCOMMENT"Agent ID",`database_id`bigintunsignedNOTNULLCOMMENT"ID of database_info",`is_draft`boolNOTNULLCOMMENT"Is draft",`prompt_disable`boolNOTNULLDEFAULT0COMMENT"Support prompt calls: 1 not supported, 0 supported",PRIMARYKEY(`id`),UNIQUEINDEX`uniq_agent_db_draft`(`agent_id`,`database_id`,`is_draft`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT"agent_to_database info";
-- Create "agent_tool_draft" table
CREATETABLEIFNOTEXISTS`agent_tool_draft`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Primary Key ID",`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Agent ID",`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Plugin ID",`tool_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Tool ID",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`sub_url`varchar(512)NOTNULLDEFAULT""COMMENT"Sub URL Path",`method`varchar(64)NOTNULLDEFAULT""COMMENT"HTTP Request Method",`tool_name`varchar(255)NOTNULLDEFAULT""COMMENT"Tool Name",`tool_version`varchar(255)NOTNULLDEFAULT""COMMENT"Tool Version, e.g. v1.0.0",`operation`jsonNULLCOMMENT"Tool Openapi Operation Schema",PRIMARYKEY(`id`),INDEX`idx_agent_plugin_tool`(`agent_id`,`plugin_id`,`tool_id`),INDEX`idx_agent_tool_bind`(`agent_id`,`created_at`),UNIQUEINDEX`uniq_idx_agent_tool_id`(`agent_id`,`tool_id`),UNIQUEINDEX`uniq_idx_agent_tool_name`(`agent_id`,`tool_name`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Draft Agent Tool";
-- Create "agent_tool_version" table
CREATETABLEIFNOTEXISTS`agent_tool_version`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Primary Key ID",`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Agent ID",`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Plugin ID",`tool_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Tool ID",`agent_version`varchar(255)NOTNULLDEFAULT""COMMENT"Agent Tool Version",`tool_name`varchar(255)NOTNULLDEFAULT""COMMENT"Tool Name",`tool_version`varchar(255)NOTNULLDEFAULT""COMMENT"Tool Version, e.g. v1.0.0",`sub_url`varchar(512)NOTNULLDEFAULT""COMMENT"Sub URL Path",`method`varchar(64)NOTNULLDEFAULT""COMMENT"HTTP Request Method",`operation`jsonNULLCOMMENT"Tool Openapi Operation Schema",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",PRIMARYKEY(`id`),INDEX`idx_agent_tool_id_created_at`(`agent_id`,`tool_id`,`created_at`),INDEX`idx_agent_tool_name_created_at`(`agent_id`,`tool_name`,`created_at`),UNIQUEINDEX`uniq_idx_agent_tool_id_agent_version`(`agent_id`,`tool_id`,`agent_version`),UNIQUEINDEX`uniq_idx_agent_tool_name_agent_version`(`agent_id`,`tool_name`,`agent_version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Agent Tool Version";
-- Create "api_key" table
CREATETABLEIFNOTEXISTS`api_key`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"Primary Key ID",`api_key`varchar(255)NOTNULLDEFAULT""COMMENT"API Key hash",`name`varchar(255)NOTNULLDEFAULT""COMMENT"API Key Name",`status`tinyintNOTNULLDEFAULT0COMMENT"0 normal, 1 deleted",`user_id`bigintNOTNULLDEFAULT0COMMENT"API Key Owner",`expired_at`bigintNOTNULLDEFAULT0COMMENT"API Key Expired Time",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`last_used_at`bigintNOTNULLDEFAULT0COMMENT"Used Time in Milliseconds",PRIMARYKEY(`id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"api key table";
-- Create "app_connector_release_ref" table
CREATETABLEIFNOTEXISTS`app_connector_release_ref`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Primary Key",`record_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Publish Record ID",`connector_id`bigintunsignedNULLCOMMENT"Publish Connector ID",`publish_config`jsonNULLCOMMENT"Publish Configuration",`publish_status`tinyintNOTNULLDEFAULT0COMMENT"Publish Status",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",PRIMARYKEY(`id`),UNIQUEINDEX`uniq_record_connector`(`record_id`,`connector_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Connector Release Record Reference";
-- Create "app_draft" table
CREATETABLEIFNOTEXISTS`app_draft`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"APP ID",`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Space ID",`owner_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Owner ID",`icon_uri`varchar(512)NOTNULLDEFAULT""COMMENT"Icon URI",`name`varchar(255)NOTNULLDEFAULT""COMMENT"Application Name",`description`textNULLCOMMENT"Application Description",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetimeNULLCOMMENT"Delete Time",PRIMARYKEY(`id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Draft Application";
-- Create "app_release_record" table
CREATETABLEIFNOTEXISTS`app_release_record`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Publish Record ID",`app_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Application ID",`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Space ID",`owner_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Owner ID",`icon_uri`varchar(512)NOTNULLDEFAULT""COMMENT"Icon URI",`name`varchar(255)NOTNULLDEFAULT""COMMENT"Application Name",`description`textNULLCOMMENT"Application Description",`connector_ids`jsonNULLCOMMENT"Publish Connector IDs",`extra_info`jsonNULLCOMMENT"Publish Extra Info",`version`varchar(255)NOTNULLDEFAULT""COMMENT"Release Version",`version_desc`textNULLCOMMENT"Version Description",`publish_status`tinyintNOTNULLDEFAULT0COMMENT"Publish Status",`publish_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Publish Time in Milliseconds",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",PRIMARYKEY(`id`),INDEX`idx_app_publish_at`(`app_id`,`publish_at`),UNIQUEINDEX`uniq_idx_app_version_connector`(`app_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Application Release Record";
-- Create "connector_workflow_version" table
CREATETABLEIFNOTEXISTS`connector_workflow_version`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"id",`app_id`bigintunsignedNOTNULLCOMMENT"app id",`connector_id`bigintunsignedNOTNULLCOMMENT"connector id",`workflow_id`bigintunsignedNOTNULLCOMMENT"workflow id",`version`varchar(256)NOTNULLCOMMENT"version",`created_at`bigintunsignedNOTNULLCOMMENT"create time in millisecond",PRIMARYKEY(`id`),INDEX`idx_connector_id_workflow_id_create_at`(`connector_id`,`workflow_id`,`created_at`),UNIQUEINDEX`idx_connector_id_workflow_id_version`(`connector_id`,`workflow_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ci;
-- Create "conversation" table
CREATETABLEIFNOTEXISTS`conversation`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"id",`connector_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Publish Connector ID",`agent_id`bigintNOTNULLDEFAULT0COMMENT"agent_id",`scene`tinyintNOTNULLDEFAULT0COMMENT"conversation scene",`section_id`bigintunsignedNOTNULLDEFAULT0COMMENT"section_id",`creator_id`bigintunsignedNULLDEFAULT0COMMENT"creator_id",`ext`textNULLCOMMENT"ext",`status`tinyintNOTNULLDEFAULT1COMMENT"status: 1-normal 2-deleted",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",PRIMARYKEY(`id`),INDEX`idx_connector_bot_status`(`connector_id`,`agent_id`,`creator_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"conversation info record"AUTO_INCREMENT7532101736270397441;
-- Create "data_copy_task" table
CREATETABLEIFNOTEXISTS`data_copy_task`(`master_task_id`varchar(128)NULLDEFAULT""COMMENT"task id",`origin_data_id`bigintunsignedNOTNULLDEFAULT0COMMENT"origin data id",`target_data_id`bigintunsignedNOTNULLDEFAULT0COMMENT"target data id",`origin_space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"origin space id",`target_space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"target space id",`origin_user_id`bigintunsignedNOTNULLDEFAULT0COMMENT"origin user id",`target_user_id`bigintunsignedNULLDEFAULT0COMMENT"target user id",`origin_app_id`bigintunsignedNOTNULLDEFAULT0COMMENT"origin app id",`target_app_id`bigintunsignedNOTNULLDEFAULT0COMMENT"target app id",`data_type`tinyintunsignedNOTNULLDEFAULT0COMMENT"data type 1:knowledge, 2:database",`ext_info`varchar(255)NOTNULLDEFAULT""COMMENT"ext",`start_time`bigintNULLDEFAULT0COMMENT"task start time",`finish_time`bigintNULLCOMMENT"task finish time",`status`tinyintNOTNULLDEFAULT1COMMENT"1: Create 2: Running 3: Success 4: Failure",`error_msg`varchar(128)NULLCOMMENT"error msg",`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"ID",PRIMARYKEY(`id`),UNIQUEINDEX`uniq_master_task_id_origin_data_id_data_type`(`master_task_id`,`origin_data_id`,`data_type`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT"data copy task record";
-- Create "draft_database_info" table
CREATETABLEIFNOTEXISTS`draft_database_info`(`id`bigintunsignedNOTNULLCOMMENT"ID",`app_id`bigintunsignedNULLCOMMENT"App ID",`space_id`bigintunsignedNOTNULLCOMMENT"Space ID",`related_online_id`bigintunsignedNOTNULLCOMMENT"The primary key ID of online_database_info table",`is_visible`tinyintNOTNULLDEFAULT1COMMENT"Visibility: 0 invisible, 1 visible",`prompt_disabled`tinyintNOTNULLDEFAULT0COMMENT"Support prompt calls: 1 not supported, 0 supported",`table_name`varchar(255)NOTNULLCOMMENT"Table name",`table_desc`varchar(256)NULLCOMMENT"Table description",`table_field`textNULLCOMMENT"Table field info",`creator_id`bigintNOTNULLDEFAULT0COMMENT"Creator ID",`icon_uri`varchar(255)NOTNULLCOMMENT"Icon Uri",`physical_table_name`varchar(255)NULLCOMMENT"The name of the real physical table",`rw_mode`bigintNOTNULLDEFAULT1COMMENT"Read and write permission modes: 1. Limited read and write mode 2. Read-only mode 3. Full read and write mode",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetimeNULLCOMMENT"Delete Time",PRIMARYKEY(`id`),INDEX`idx_space_app_creator_deleted`(`space_id`,`app_id`,`creator_id`,`deleted_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT"draft database info";
-- Create "knowledge" table
CREATETABLEIFNOTEXISTS`knowledge`(`id`bigintunsignedNOTNULLCOMMENT"id",`name`varchar(150)NOTNULLDEFAULT""COMMENT"knowledge's name",`app_id`bigintNOTNULLDEFAULT0COMMENT"app id",`creator_id`bigintunsignedNOTNULLDEFAULT0COMMENT"creator id",`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"space id",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetime(3)NULLCOMMENT"Delete Time",`status`tinyintNOTNULLDEFAULT1COMMENT"0 initialization, 1 effective, 2 invalid",`description`textNULLCOMMENT"description",`icon_uri`varchar(150)NULLCOMMENT"icon uri",`format_type`tinyintNOTNULLDEFAULT0COMMENT"0: Text 1: Table 2: Images",PRIMARYKEY(`id`),INDEX`idx_app_id`(`app_id`),INDEX`idx_creator_id`(`creator_id`),INDEX`idx_space_id_deleted_at_updated_at`(`space_id`,`deleted_at`,`updated_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"knowledge tabke";
-- Create "knowledge_document" table
CREATETABLEIFNOTEXISTS`knowledge_document`(`id`bigintunsignedNOTNULLCOMMENT"id",`knowledge_id`bigintunsignedNOTNULLDEFAULT0COMMENT"knowledge id",`name`varchar(150)NOTNULLDEFAULT""COMMENT"document name",`file_extension`varchar(20)NOTNULLDEFAULT"0"COMMENT"Document type, txt/pdf/csv etc..",`document_type`intNOTNULLDEFAULT0COMMENT"Document type: 0: Text 1: Table 2: Image",`uri`textNULLCOMMENT"uri",`size`bigintunsignedNOTNULLDEFAULT0COMMENT"document size",`slice_count`bigintunsignedNOTNULLDEFAULT0COMMENT"slice count",`char_count`bigintunsignedNOTNULLDEFAULT0COMMENT"number of characters",`creator_id`bigintunsignedNOTNULLDEFAULT0COMMENT"creator id",`space_id`bigintNOTNULLDEFAULT0COMMENT"space id",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetime(3)NULLCOMMENT"Delete Time",`source_type`intNULLDEFAULT0COMMENT"0: Local file upload, 2: Custom text, 103: Feishu 104: Lark",`status`intNOTNULLDEFAULT0COMMENT"status",`fail_reason`textNULLCOMMENT"fail reason",`parse_rule`jsonNULLCOMMENT"parse rule",`table_info`jsonNULLCOMMENT"table info",PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`),INDEX`idx_knowledge_id_deleted_at_updated_at`(`knowledge_id`,`deleted_at`,`updated_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"knowledge document info";
-- Create "knowledge_document_review" table
CREATETABLEIFNOTEXISTS`knowledge_document_review`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"id",`knowledge_id`bigintunsignedNOTNULLDEFAULT0COMMENT"knowledge id",`space_id`bigintNOTNULLDEFAULT0COMMENT"space id",`name`varchar(150)NOTNULLDEFAULT""COMMENT"name",`type`varchar(10)NOTNULLDEFAULT"0"COMMENT"document type",`uri`textNULLCOMMENT"uri",`format_type`tinyintunsignedNOTNULLDEFAULT0COMMENT"0 text, 1 table, 2 images",`status`tinyintunsignedNOTNULLDEFAULT0COMMENT"0 Processing 1 Completed 2 Failed 3 Expired",`chunk_resp_uri`textNULLCOMMENT"pre-sliced uri",`deleted_at`datetime(3)NULLCOMMENT"Delete Time",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`creator_id`bigintNOTNULLDEFAULT0COMMENT"creator id",PRIMARYKEY(`id`),INDEX`idx_dataset_id`(`knowledge_id`,`status`,`updated_at`),INDEX`idx_uri`(`uri`(100)))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Document slice preview info";
-- Create "knowledge_document_slice" table
CREATETABLEIFNOTEXISTS`knowledge_document_slice`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"id",`knowledge_id`bigintunsignedNOTNULLDEFAULT0COMMENT"knowledge id",`document_id`bigintunsignedNOTNULLDEFAULT0COMMENT"document_id",`content`textNULLCOMMENT"content",`sequence`decimal(20,5)NOTNULLCOMMENT"slice sequence number, starting from 1",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetime(3)NULLCOMMENT"Delete Time",`creator_id`bigintNOTNULLDEFAULT0COMMENT"creator id",`space_id`bigintNOTNULLDEFAULT0COMMENT"space id",`status`intNOTNULLDEFAULT0COMMENT"status",`fail_reason`textNULLCOMMENT"fail reason",`hit`bigintunsignedNOTNULLDEFAULT0COMMENT"hit counts ",PRIMARYKEY(`id`),INDEX`idx_document_id_deleted_at_sequence`(`document_id`,`deleted_at`,`sequence`),INDEX`idx_knowledge_id_document_id`(`knowledge_id`,`document_id`),INDEX`idx_sequence`(`sequence`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"knowledge document slice";
-- Create "message" table
CREATETABLEIFNOTEXISTS`message`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"id",`run_id`bigintunsignedNOTNULLDEFAULT0COMMENT"run_id",`conversation_id`bigintunsignedNOTNULLDEFAULT0COMMENT"conversation id",`user_id`varchar(60)NOTNULLDEFAULT""COMMENT"user id",`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT"agent_id",`role`varchar(100)NOTNULLDEFAULT""COMMENT"role: user、assistant、system",`content_type`varchar(100)NOTNULLDEFAULT""COMMENT"content type 1 text",`content`mediumtextNULLCOMMENT"content",`message_type`varchar(100)NOTNULLDEFAULT""COMMENT"message_type",`display_content`textNULLCOMMENT"display content",`ext`textNULLCOMMENT"message ext"COLLATEutf8mb4_general_ci,`section_id`bigintunsignedNULLCOMMENT"section_id",`broken_position`intNULLDEFAULT-1COMMENT"broken position",`status`tinyintunsignedNOTNULLDEFAULT0COMMENT"message status: 1 Available 2 Deleted 3 Replaced 4 Broken 5 Failed 6 Streaming 7 Pending",`model_content`mediumtextNULLCOMMENT"model content",`meta_info`textNULLCOMMENT"text tagging information such as citation and highlighting",`reasoning_content`textNULLCOMMENT"reasoning content"COLLATEutf8mb4_general_ci,`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",PRIMARYKEY(`id`),INDEX`idx_conversation_id`(`conversation_id`),INDEX`idx_run_id`(`run_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"message record";
-- Create "model_entity" table
CREATETABLEIFNOTEXISTS`model_entity`(`id`bigintunsignedNOTNULLCOMMENT"id",`meta_id`bigintunsignedNOTNULLCOMMENT"model metadata id",`name`varchar(128)NOTNULLCOMMENT"name",`description`textNULLCOMMENT"description",`default_params`jsonNULLCOMMENT"default params",`scenario`bigintunsignedNOTNULLCOMMENT"scenario",`status`intNOTNULLDEFAULT1COMMENT"model status",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`bigintunsignedNULLCOMMENT"Delete Time",PRIMARYKEY(`id`),INDEX`idx_scenario`(`scenario`),INDEX`idx_status`(`status`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Model information";
-- Create "model_meta" table
CREATETABLEIFNOTEXISTS`model_meta`(`id`bigintunsignedNOTNULLCOMMENT"id",`model_name`varchar(128)NOTNULLCOMMENT"model name",`protocol`varchar(128)NOTNULLCOMMENT"model protocol",`icon_uri`varchar(255)NOTNULLDEFAULT""COMMENT"Icon URI",`capability`jsonNULLCOMMENT"capability",`conn_config`jsonNULLCOMMENT"model conn config",`status`intNOTNULLDEFAULT1COMMENT"model status",`description`varchar(2048)NOTNULLDEFAULT""COMMENT"description",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`bigintunsignedNULLCOMMENT"Delete Time",`icon_url`varchar(255)NOTNULLDEFAULT""COMMENT"Icon URL",PRIMARYKEY(`id`),INDEX`idx_status`(`status`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Model metadata";
-- Create "node_execution" table
CREATETABLEIFNOTEXISTS`node_execution`(`id`bigintunsignedNOTNULLCOMMENT"node execution id",`execute_id`bigintunsignedNOTNULLCOMMENT"the workflow execute id this node execution belongs to",`node_id`varchar(128)NOTNULLCOMMENT"node key"COLLATEutf8mb4_unicode_ci,`node_name`varchar(128)NOTNULLCOMMENT"name of the node"COLLATEutf8mb4_unicode_ci,`node_type`varchar(128)NOTNULLCOMMENT"the type of the node, in string"COLLATEutf8mb4_unicode_ci,`created_at`bigintunsignedNOTNULLCOMMENT"create time in millisecond",`status`tinyintunsignedNOTNULLCOMMENT"1=waiting 2=running 3=success 4=fail",`duration`bigintunsignedNULLCOMMENT"execution duration in millisecond",`input`mediumtextNULLCOMMENT"actual input of the node"COLLATEutf8mb4_unicode_ci,`output`mediumtextNULLCOMMENT"actual output of the node"COLLATEutf8mb4_unicode_ci,`raw_output`mediumtextNULLCOMMENT"the original output of the node"COLLATEutf8mb4_unicode_ci,`error_info`mediumtextNULLCOMMENT"error info"COLLATEutf8mb4_unicode_ci,`error_level`varchar(32)NULLCOMMENT"level of the error"COLLATEutf8mb4_unicode_ci,`input_tokens`bigintunsignedNULLCOMMENT"number of input tokens",`output_tokens`bigintunsignedNULLCOMMENT"number of output tokens",`updated_at`bigintunsignedNULLCOMMENT"update time in millisecond",`composite_node_index`bigintunsignedNULLCOMMENT"loop or batch's execution index",`composite_node_items`mediumtextNULLCOMMENT"the items extracted from parent composite node for this index"COLLATEutf8mb4_unicode_ci,`parent_node_id`varchar(128)NULLCOMMENT"when as inner node for loop or batch, this is the parent node's key"COLLATEutf8mb4_unicode_ci,`sub_execute_id`bigintunsignedNULLCOMMENT"if this node is sub_workflow, the exe id of the sub workflow",`extra`mediumtextNULLCOMMENT"extra info"COLLATEutf8mb4_unicode_ci,PRIMARYKEY(`id`),INDEX`idx_execute_id_node_id`(`execute_id`,`node_id`),INDEX`idx_execute_id_parent_node_id`(`execute_id`,`parent_node_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_0900_ai_ciCOMMENT"Node run record, used to record the status information of each node during each workflow execution";
-- Create "online_database_info" table
CREATETABLEIFNOTEXISTS`online_database_info`(`id`bigintunsignedNOTNULLCOMMENT"ID",`app_id`bigintunsignedNULLCOMMENT"App ID",`space_id`bigintunsignedNOTNULLCOMMENT"Space ID",`related_draft_id`bigintunsignedNOTNULLCOMMENT"The primary key ID of draft_database_info table",`is_visible`tinyintNOTNULLDEFAULT1COMMENT"Visibility: 0 invisible, 1 visible",`prompt_disabled`tinyintNOTNULLDEFAULT0COMMENT"Support prompt calls: 1 not supported, 0 supported",`table_name`varchar(255)NOTNULLCOMMENT"Table name",`table_desc`varchar(256)NULLCOMMENT"Table description",`table_field`textNULLCOMMENT"Table field info",`creator_id`bigintNOTNULLDEFAULT0COMMENT"Creator ID",`icon_uri`varchar(255)NOTNULLCOMMENT"Icon Uri",`physical_table_name`varchar(255)NULLCOMMENT"The name of the real physical table",`rw_mode`bigintNOTNULLDEFAULT1COMMENT"Read and write permission modes: 1. Limited read and write mode 2. Read-only mode 3. Full read and write mode",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetimeNULLCOMMENT"Delete Time",PRIMARYKEY(`id`),INDEX`idx_space_app_creator_deleted`(`space_id`,`app_id`,`creator_id`,`deleted_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT"online database info";
-- Create "plugin" table
CREATETABLEIFNOTEXISTS`plugin`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Plugin ID",`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Space ID",`developer_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Developer ID",`app_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Application ID",`icon_uri`varchar(512)NOTNULLDEFAULT""COMMENT"Icon URI",`server_url`varchar(512)NOTNULLDEFAULT""COMMENT"Server URL",`plugin_type`tinyintNOTNULLDEFAULT0COMMENT"Plugin Type, 1:http, 6:local",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`version`varchar(255)NOTNULLDEFAULT""COMMENT"Plugin Version, e.g. v1.0.0",`version_desc`textNULLCOMMENT"Plugin Version Description",`manifest`jsonNULLCOMMENT"Plugin Manifest",`openapi_doc`jsonNULLCOMMENT"OpenAPI Document, only stores the root",PRIMARYKEY(`id`),INDEX`idx_space_created_at`(`space_id`,`created_at`),INDEX`idx_space_updated_at`(`space_id`,`updated_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Latest Plugin";
-- Create "plugin_draft" table
CREATETABLEIFNOTEXISTS`plugin_draft`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Plugin ID",`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Space ID",`developer_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Developer ID",`app_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Application ID",`icon_uri`varchar(512)NOTNULLDEFAULT""COMMENT"Icon URI",`server_url`varchar(512)NOTNULLDEFAULT""COMMENT"Server URL",`plugin_type`tinyintNOTNULLDEFAULT0COMMENT"Plugin Type, 1:http, 6:local",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetimeNULLCOMMENT"Delete Time",`manifest`jsonNULLCOMMENT"Plugin Manifest",`openapi_doc`jsonNULLCOMMENT"OpenAPI Document, only stores the root",PRIMARYKEY(`id`),INDEX`idx_app_id`(`app_id`,`id`),INDEX`idx_space_app_created_at`(`space_id`,`app_id`,`created_at`),INDEX`idx_space_app_updated_at`(`space_id`,`app_id`,`updated_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Draft Plugin";
-- Create "plugin_oauth_auth" table
CREATETABLEIFNOTEXISTS`plugin_oauth_auth`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Primary Key",`user_id`varchar(255)NOTNULLDEFAULT""COMMENT"User ID",`plugin_id`bigintNOTNULLDEFAULT0COMMENT"Plugin ID",`is_draft`boolNOTNULLDEFAULT0COMMENT"Is Draft Plugin",`oauth_config`jsonNULLCOMMENT"Authorization Code OAuth Config",`access_token`textNOTNULLCOMMENT"Access Token",`refresh_token`textNOTNULLCOMMENT"Refresh Token",`token_expired_at`bigintNULLCOMMENT"Token Expired in Milliseconds",`next_token_refresh_at`bigintNULLCOMMENT"Next Token Refresh Time in Milliseconds",`last_active_at`bigintNULLCOMMENT"Last active time in Milliseconds",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",PRIMARYKEY(`id`),INDEX`idx_last_active_at`(`last_active_at`),INDEX`idx_last_token_expired_at`(`token_expired_at`),INDEX`idx_next_token_refresh_at`(`next_token_refresh_at`),UNIQUEINDEX`uniq_idx_user_plugin_is_draft`(`user_id`,`plugin_id`,`is_draft`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Plugin OAuth Authorization Code Info";
-- Create "plugin_version" table
CREATETABLEIFNOTEXISTS`plugin_version`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Primary Key ID",`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Space ID",`developer_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Developer ID",`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Plugin ID",`app_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Application ID",`icon_uri`varchar(512)NOTNULLDEFAULT""COMMENT"Icon URI",`server_url`varchar(512)NOTNULLDEFAULT""COMMENT"Server URL",`plugin_type`tinyintNOTNULLDEFAULT0COMMENT"Plugin Type, 1:http, 6:local",`version`varchar(255)NOTNULLDEFAULT""COMMENT"Plugin Version, e.g. v1.0.0",`version_desc`textNULLCOMMENT"Plugin Version Description",`manifest`jsonNULLCOMMENT"Plugin Manifest",`openapi_doc`jsonNULLCOMMENT"OpenAPI Document, only stores the root",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`deleted_at`datetimeNULLCOMMENT"Delete Time",PRIMARYKEY(`id`),UNIQUEINDEX`uniq_idx_plugin_version`(`plugin_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Plugin Version";
-- Create "prompt_resource" table
CREATETABLEIFNOTEXISTS`prompt_resource`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"id",`space_id`bigintNOTNULLCOMMENT"space id",`name`varchar(255)NOTNULLCOMMENT"name",`description`varchar(255)NOTNULLCOMMENT"description",`prompt_text`mediumtextNULLCOMMENT"prompt text",`status`intNOTNULLCOMMENT"status, 0 is invalid, 1 is valid",`creator_id`bigintNOTNULLCOMMENT"creator id",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_0900_ai_ciCOMMENT"prompt_resource";
-- Create "run_record" table
CREATETABLEIFNOTEXISTS`run_record`(`id`bigintunsignedNOTNULLCOMMENT"id",`conversation_id`bigintunsignedNOTNULLDEFAULT0COMMENT"conversation id",`section_id`bigintunsignedNOTNULLDEFAULT0COMMENT"section ID",`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT"agent_id",`user_id`varchar(255)NOTNULLDEFAULT""COMMENT"user id",`source`tinyintunsignedNOTNULLDEFAULT0COMMENT"Execute source 0 API",`status`varchar(255)NOTNULLDEFAULT""COMMENT"status,0 Unknown, 1-Created,2-InProgress,3-Completed,4-Failed,5-Expired,6-Cancelled,7-RequiresAction",`creator_id`bigintNOTNULLDEFAULT0COMMENT"creator id",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`failed_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Fail Time in Milliseconds",`last_error`textNULLCOMMENT"error message"COLLATEutf8mb4_general_ci,`completed_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Finish Time in Milliseconds",`chat_request`textNULLCOMMENT"Original request field"COLLATEutf8mb4_general_ci,`ext`textNULLCOMMENT"ext"COLLATEutf8mb4_general_ci,`usage`jsonNULLCOMMENT"usage",PRIMARYKEY(`id`),INDEX`idx_c_s`(`conversation_id`,`section_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"run record";
-- Create "shortcut_command" table
CREATETABLEIFNOTEXISTS`shortcut_command`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"id",`object_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Entity ID, this command can be used for this entity",`command_id`bigintunsignedNOTNULLDEFAULT0COMMENT"command id",`command_name`varchar(255)NOTNULLDEFAULT""COMMENT"command name",`shortcut_command`varchar(255)NOTNULLDEFAULT""COMMENT"shortcut command",`description`varchar(2000)NOTNULLDEFAULT""COMMENT"description",`send_type`tinyintunsignedNOTNULLDEFAULT0COMMENT"send type 0:query 1:panel",`tool_type`tinyintunsignedNOTNULLDEFAULT0COMMENT"Type 1 of tool used: WorkFlow 2: Plugin",`work_flow_id`bigintunsignedNOTNULLDEFAULT0COMMENT"workflow id",`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT"plugin id",`plugin_tool_name`varchar(255)NOTNULLDEFAULT""COMMENT"plugin tool name",`template_query`textNULLCOMMENT"template query",`components`jsonNULLCOMMENT"Panel parameters",`card_schema`textNULLCOMMENT"card schema",`tool_info`jsonNULLCOMMENT"Tool information includes name+variable list",`status`tinyintunsignedNOTNULLDEFAULT0COMMENT"Status, 0 is invalid, 1 is valid",`creator_id`bigintunsignedNULLDEFAULT0COMMENT"creator id",`is_online`tinyintunsignedNOTNULLDEFAULT0COMMENT"Is online information: 0 draft 1 online",`created_at`bigintNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT"When executing a multi instruction, which node executes the instruction",`shortcut_icon`jsonNULLCOMMENT"shortcut icon",`plugin_tool_id`bigintNOTNULLDEFAULT0COMMENT"tool_id",PRIMARYKEY(`id`),UNIQUEINDEX`uniq_object_command_id_type`(`object_id`,`command_id`,`is_online`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT"bot shortcut command table";
-- Create "single_agent_draft" table
CREATETABLEIFNOTEXISTS`single_agent_draft`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"Primary Key ID",`agent_id`bigintNOTNULLDEFAULT0COMMENT"Agent ID",`creator_id`bigintNOTNULLDEFAULT0COMMENT"Creator ID",`space_id`bigintNOTNULLDEFAULT0COMMENT"Space ID",`name`varchar(255)NOTNULLDEFAULT""COMMENT"Agent Name",`description`textNOTNULLCOMMENT"Agent Description",`icon_uri`varchar(255)NOTNULLDEFAULT""COMMENT"Icon URI",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetime(3)NULLCOMMENT"delete time in millisecond",`variables_meta_id`bigintNULLCOMMENT"variables meta table ID",`model_info`jsonNULLCOMMENT"Model Configuration Information",`onboarding_info`jsonNULLCOMMENT"Onboarding Information",`prompt`jsonNULLCOMMENT"Agent Prompt Configuration",`plugin`jsonNULLCOMMENT"Agent Plugin Base Configuration",`knowledge`jsonNULLCOMMENT"Agent Knowledge Base Configuration",`workflow`jsonNULLCOMMENT"Agent Workflow Configuration",`suggest_reply`jsonNULLCOMMENT"Suggested Replies",`jump_config`jsonNULLCOMMENT"Jump Configuration",`background_image_info_list`jsonNULLCOMMENT"Background image",`database_config`jsonNULLCOMMENT"Agent Database Base Configuration",`shortcut_command`jsonNULLCOMMENT"shortcut command",PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`),UNIQUEINDEX`uniq_agent_id`(`agent_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Single Agent Draft Copy Table"AUTO_INCREMENT29;
-- Create "single_agent_publish" table
CREATETABLEIFNOTEXISTS`single_agent_publish`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"id",`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT"agent_id",`publish_id`varchar(50)NOTNULLDEFAULT""COMMENT"publish id"COLLATEutf8mb4_general_ci,`connector_ids`jsonNULLCOMMENT"connector_ids",`version`varchar(255)NOTNULLDEFAULT""COMMENT"Agent Version",`publish_info`textNULLCOMMENT"publish info"COLLATEutf8mb4_general_ci,`publish_time`bigintunsignedNOTNULLDEFAULT0COMMENT"publish time",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`creator_id`bigintunsignedNOTNULLDEFAULT0COMMENT"creator id",`status`tinyintNOTNULLDEFAULT0COMMENT"Status 0: In use 1: Delete 3: Disabled",`extra`jsonNULLCOMMENT"extra",PRIMARYKEY(`id`),INDEX`idx_agent_id_version`(`agent_id`,`version`),INDEX`idx_creator_id`(`creator_id`),INDEX`idx_publish_id`(`publish_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Bot connector and release version info";
-- Create "single_agent_version" table
CREATETABLEIFNOTEXISTS`single_agent_version`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"Primary Key ID",`agent_id`bigintNOTNULLDEFAULT0COMMENT"Agent ID",`creator_id`bigintNOTNULLDEFAULT0COMMENT"Creator ID",`space_id`bigintNOTNULLDEFAULT0COMMENT"Space ID",`name`varchar(255)NOTNULLDEFAULT""COMMENT"Agent Name",`description`textNOTNULLCOMMENT"Agent Description",`icon_uri`varchar(255)NOTNULLDEFAULT""COMMENT"Icon URI",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`deleted_at`datetime(3)NULLCOMMENT"delete time in millisecond",`variables_meta_id`bigintNULLCOMMENT"variables meta table ID",`model_info`jsonNULLCOMMENT"Model Configuration Information",`onboarding_info`jsonNULLCOMMENT"Onboarding Information",`prompt`jsonNULLCOMMENT"Agent Prompt Configuration",`plugin`jsonNULLCOMMENT"Agent Plugin Base Configuration",`knowledge`jsonNULLCOMMENT"Agent Knowledge Base Configuration",`workflow`jsonNULLCOMMENT"Agent Workflow Configuration",`suggest_reply`jsonNULLCOMMENT"Suggested Replies",`jump_config`jsonNULLCOMMENT"Jump Configuration",`connector_id`bigintunsignedNOTNULLCOMMENT"Connector ID",`version`varchar(255)NOTNULLDEFAULT""COMMENT"Agent Version",`background_image_info_list`jsonNULLCOMMENT"Background image",`database_config`jsonNULLCOMMENT"Agent Database Base Configuration",`shortcut_command`jsonNULLCOMMENT"shortcut command",PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`),UNIQUEINDEX`uniq_agent_id_and_version_connector_id`(`agent_id`,`version`,`connector_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Single Agent Version Copy Table";
-- Create "space" table
CREATETABLEIFNOTEXISTS`space`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"Primary Key ID, Space ID",`owner_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Owner ID",`name`varchar(200)NOTNULLDEFAULT""COMMENT"Space Name",`description`varchar(2000)NOTNULLDEFAULT""COMMENT"Space Description",`icon_uri`varchar(200)NOTNULLDEFAULT""COMMENT"Icon URI",`creator_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Creator ID",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Creation Time (Milliseconds)",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time (Milliseconds)",`deleted_at`bigintunsignedNULLCOMMENT"Deletion Time (Milliseconds)",PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`),INDEX`idx_owner_id`(`owner_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Space Table"AUTO_INCREMENT7532071516331048961;
-- Create "space_user" table
CREATETABLEIFNOTEXISTS`space_user`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"Primary Key ID, Auto Increment",`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Space ID",`user_id`bigintunsignedNOTNULLDEFAULT0COMMENT"User ID",`role_type`intNOTNULLDEFAULT3COMMENT"Role Type: 1.owner 2.admin 3.member",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Creation Time (Milliseconds)",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time (Milliseconds)",PRIMARYKEY(`id`),INDEX`idx_user_id`(`user_id`),UNIQUEINDEX`uniq_space_user`(`space_id`,`user_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Space Member Table"AUTO_INCREMENT2;
-- Create "template" table
CREATETABLEIFNOTEXISTS`template`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"Primary Key ID",`agent_id`bigintNOTNULLDEFAULT0COMMENT"Agent ID",`workflow_id`bigintNOTNULLDEFAULT0COMMENT"Workflow ID",`space_id`bigintNOTNULLDEFAULT0COMMENT"Space ID",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`heat`bigintunsignedNOTNULLDEFAULT0COMMENT"Heat",`product_entity_type`bigintunsignedNOTNULLDEFAULT0COMMENT"Product Entity Type",`meta_info`jsonNULLCOMMENT"Meta Info",`agent_extra`jsonNULLCOMMENT"Agent Extra Info",`workflow_extra`jsonNULLCOMMENT"Workflow Extra Info",`project_extra`jsonNULLCOMMENT"Project Extra Info",PRIMARYKEY(`id`),UNIQUEINDEX`uniq_agent_id`(`agent_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Template Info Table"AUTO_INCREMENT25;
-- Create "tool" table
CREATETABLEIFNOTEXISTS`tool`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Tool ID",`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Plugin ID",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`version`varchar(255)NOTNULLDEFAULT""COMMENT"Tool Version, e.g. v1.0.0",`sub_url`varchar(512)NOTNULLDEFAULT""COMMENT"Sub URL Path",`method`varchar(64)NOTNULLDEFAULT""COMMENT"HTTP Request Method",`operation`jsonNULLCOMMENT"Tool Openapi Operation Schema",`activated_status`tinyintunsignedNOTNULLDEFAULT0COMMENT"0:activated; 1:deactivated",PRIMARYKEY(`id`),INDEX`idx_plugin_activated_status`(`plugin_id`,`activated_status`),UNIQUEINDEX`uniq_idx_plugin_sub_url_method`(`plugin_id`,`sub_url`,`method`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Latest Tool";
-- Create "tool_draft" table
CREATETABLEIFNOTEXISTS`tool_draft`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Tool ID",`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Plugin ID",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`sub_url`varchar(512)NOTNULLDEFAULT""COMMENT"Sub URL Path",`method`varchar(64)NOTNULLDEFAULT""COMMENT"HTTP Request Method",`operation`jsonNULLCOMMENT"Tool Openapi Operation Schema",`debug_status`tinyintunsignedNOTNULLDEFAULT0COMMENT"0:not pass; 1:pass",`activated_status`tinyintunsignedNOTNULLDEFAULT0COMMENT"0:activated; 1:deactivated",PRIMARYKEY(`id`),INDEX`idx_plugin_created_at_id`(`plugin_id`,`created_at`,`id`),UNIQUEINDEX`uniq_idx_plugin_sub_url_method`(`plugin_id`,`sub_url`,`method`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Draft Tool";
-- Create "tool_version" table
CREATETABLEIFNOTEXISTS`tool_version`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"Primary Key ID",`tool_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Tool ID",`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT"Plugin ID",`version`varchar(255)NOTNULLDEFAULT""COMMENT"Tool Version, e.g. v1.0.0",`sub_url`varchar(512)NOTNULLDEFAULT""COMMENT"Sub URL Path",`method`varchar(64)NOTNULLDEFAULT""COMMENT"HTTP Request Method",`operation`jsonNULLCOMMENT"Tool Openapi Operation Schema",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`deleted_at`datetimeNULLCOMMENT"Delete Time",PRIMARYKEY(`id`),UNIQUEINDEX`uniq_idx_tool_version`(`tool_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Tool Version";
-- Create "user" table
CREATETABLEIFNOTEXISTS`user`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"Primary Key ID",`name`varchar(128)NOTNULLDEFAULT""COMMENT"User Nickname",`unique_name`varchar(128)NOTNULLDEFAULT""COMMENT"User Unique Name",`email`varchar(128)NOTNULLDEFAULT""COMMENT"Email",`password`varchar(128)NOTNULLDEFAULT""COMMENT"Password (Encrypted)",`description`varchar(512)NOTNULLDEFAULT""COMMENT"User Description",`icon_uri`varchar(512)NOTNULLDEFAULT""COMMENT"Avatar URI",`user_verified`boolNOTNULLDEFAULT0COMMENT"User Verification Status",`locale`varchar(128)NOTNULLDEFAULT""COMMENT"Locale",`session_key`varchar(256)NOTNULLDEFAULT""COMMENT"Session Key",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Creation Time (Milliseconds)",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time (Milliseconds)",`deleted_at`bigintunsignedNULLCOMMENT"Deletion Time (Milliseconds)",PRIMARYKEY(`id`),INDEX`idx_session_key`(`session_key`),UNIQUEINDEX`uniq_email`(`email`),UNIQUEINDEX`uniq_unique_name`(`unique_name`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"User Table"AUTO_INCREMENT7532071516318466049;
-- Create "variable_instance" table
CREATETABLEIFNOTEXISTS`variable_instance`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"id",`biz_type`tinyintunsignedNOTNULLCOMMENT"1 for agent,2 for app",`biz_id`varchar(128)NOTNULLDEFAULT""COMMENT"1 for agent_id,2 for app_id",`version`varchar(255)NOTNULLCOMMENT"agent or project version empty represents draft status",`keyword`varchar(255)NOTNULLCOMMENT"Keyword to Memory",`type`tinyintNOTNULLCOMMENT"Memory type 1 KV 2 list",`content`textNULLCOMMENT"content",`connector_uid`varchar(255)NOTNULLCOMMENT"connector_uid",`connector_id`bigintNOTNULLCOMMENT"connector_id, e.g. coze = 10000010",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",PRIMARYKEY(`id`),INDEX`idx_connector_key`(`biz_id`,`biz_type`,`version`,`connector_uid`,`connector_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_0900_ai_ciCOMMENT"KV Memory";
-- Create "variables_meta" table
CREATETABLEIFNOTEXISTS`variables_meta`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT"id",`creator_id`bigintunsignedNOTNULLCOMMENT"creator id",`biz_type`tinyintunsignedNOTNULLCOMMENT"1 for agent,2 for app",`biz_id`varchar(128)NOTNULLDEFAULT""COMMENT"1 for agent_id,2 for app_id",`variable_list`jsonNULLCOMMENT"JSON data for variable configuration",`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Create Time in Milliseconds",`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT"Update Time in Milliseconds",`version`varchar(255)NOTNULLCOMMENT"Project version, empty represents draft status",PRIMARYKEY(`id`),INDEX`idx_user_key`(`creator_id`),UNIQUEINDEX`uniq_project_key`(`biz_id`,`biz_type`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_0900_ai_ciCOMMENT"KV Memory meta";
-- Create "workflow_draft" table
CREATETABLEIFNOTEXISTS`workflow_draft`(`id`bigintunsignedNOTNULLCOMMENT"workflow ID",`canvas`mediumtextNOTNULLCOMMENT"Front end schema",`input_params`mediumtextNULLCOMMENT"Input schema",`output_params`mediumtextNULLCOMMENT"Output parameter schema",`test_run_success`boolNOTNULLDEFAULT0COMMENT"0 not running, 1 running successfully",`modified`boolNOTNULLDEFAULT0COMMENT"0 has not been modified, 1 has been modified",`updated_at`bigintunsignedNULLCOMMENT"Update Time in Milliseconds",`deleted_at`datetime(3)NULLCOMMENT"Delete Time",`commit_id`varchar(255)NOTNULLCOMMENT"used to uniquely identify a draft snapshot",PRIMARYKEY(`id`),INDEX`idx_updated_at`(`updated_at`DESC))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Workflow canvas draft table, used to record the latest draft canvas information of workflow";
-- Create "workflow_execution" table
CREATETABLEIFNOTEXISTS`workflow_execution`(`id`bigintunsignedNOTNULLCOMMENT"execute id",`workflow_id`bigintunsignedNOTNULLCOMMENT"workflow_id",`version`varchar(50)NULLCOMMENT"workflow version. empty if is draft",`space_id`bigintunsignedNOTNULLCOMMENT"the space id the workflow belongs to",`mode`tinyintunsignedNOTNULLCOMMENT"the execution mode: 1. debug run 2. release run 3. node debug",`operator_id`bigintunsignedNOTNULLCOMMENT"the user id that runs this workflow",`connector_id`bigintunsignedNULLCOMMENT"the connector on which this execution happened",`connector_uid`varchar(64)NULLCOMMENT"user id of the connector",`created_at`bigintunsignedNOTNULLCOMMENT"create time in millisecond",`log_id`varchar(128)NULLCOMMENT"log id",`status`tinyintunsignedNULLCOMMENT"1=running 2=success 3=fail 4=interrupted",`duration`bigintunsignedNULLCOMMENT"execution duration in millisecond",`input`mediumtextNULLCOMMENT"actual input of this execution",`output`mediumtextNULLCOMMENT"the actual output of this execution",`error_code`varchar(255)NULLCOMMENT"error code if any",`fail_reason`mediumtextNULLCOMMENT"the reason for failure",`input_tokens`bigintunsignedNULLCOMMENT"number of input tokens",`output_tokens`bigintunsignedNULLCOMMENT"number of output tokens",`updated_at`bigintunsignedNULLCOMMENT"update time in millisecond",`root_execution_id`bigintunsignedNULLCOMMENT"the top level execution id. Null if this is the root",`parent_node_id`varchar(128)NULLCOMMENT"the node key for the sub_workflow node that executes this workflow",`app_id`bigintunsignedNULLCOMMENT"app id this workflow execution belongs to",`node_count`mediumintunsignedNULLCOMMENT"the total node count of the workflow",`resume_event_id`bigintunsignedNULLCOMMENT"the current event ID which is resuming",`agent_id`bigintunsignedNULLCOMMENT"the agent that this execution binds to",`sync_pattern`tinyintunsignedNULLCOMMENT"the sync pattern 1. sync 2. async 3. stream",`commit_id`varchar(255)NULLCOMMENT"draft commit id this execution belongs to",PRIMARYKEY(`id`),INDEX`idx_workflow_id_version_mode_created_at`(`workflow_id`,`version`,`mode`,`created_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Workflow Execution Record Table, used to record the status of each workflow execution";
-- Create "workflow_meta" table
CREATETABLEIFNOTEXISTS`workflow_meta`(`id`bigintunsignedNOTNULLCOMMENT"workflow id",`name`varchar(256)NOTNULLCOMMENT"workflow name",`description`varchar(2000)NOTNULLCOMMENT"workflow description",`icon_uri`varchar(256)NOTNULLCOMMENT"icon uri",`status`tinyintunsignedNOTNULLCOMMENT"0: Not published, 1: Published",`content_type`tinyintunsignedNOTNULLCOMMENT"0 Users 1 Official",`mode`tinyintunsignedNOTNULLCOMMENT"0:workflow, 3:chat_flow",`created_at`bigintunsignedNOTNULLCOMMENT"create time in millisecond",`updated_at`bigintunsignedNULLCOMMENT"update time in millisecond",`deleted_at`datetime(3)NULLCOMMENT"delete time in millisecond",`creator_id`bigintunsignedNOTNULLCOMMENT"user id for creator",`tag`tinyintunsignedNULLCOMMENT"template tag: Tag: 1=All, 2=Hot, 3=Information, 4=Music, 5=Picture, 6=UtilityTool, 7=Life, 8=Traval, 9=Network, 10=System, 11=Movie, 12=Office, 13=Shopping, 14=Education, 15=Health, 16=Social, 17=Entertainment, 18=Finance, 100=Hidden",`author_id`bigintunsignedNOTNULLCOMMENT"Original author user ID",`space_id`bigintunsignedNOTNULLCOMMENT"space id",`updater_id`bigintunsignedNULLCOMMENT"User ID for updating metadata",`source_id`bigintunsignedNULLCOMMENT"Workflow ID of source",`app_id`bigintunsignedNULLCOMMENT"app id",`latest_version`varchar(50)NULLCOMMENT"the version of the most recent publish",`latest_version_ts`bigintunsignedNULLCOMMENT"create time of latest version",PRIMARYKEY(`id`),INDEX`idx_app_id`(`app_id`),INDEX`idx_latest_version_ts`(`latest_version_ts`DESC),INDEX`idx_space_id_app_id_status_latest_version_ts`(`space_id`,`app_id`,`status`,`latest_version_ts`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"The workflow metadata table,used to record the basic metadata of workflow";
-- Create "workflow_reference" table
CREATETABLEIFNOTEXISTS`workflow_reference`(`id`bigintunsignedNOTNULLCOMMENT"workflow id",`referred_id`bigintunsignedNOTNULLCOMMENT"the id of the workflow that is referred by other entities",`referring_id`bigintunsignedNOTNULLCOMMENT"the entity id that refers this workflow",`refer_type`tinyintunsignedNOTNULLCOMMENT"1 subworkflow 2 tool",`referring_biz_type`tinyintunsignedNOTNULLCOMMENT"the biz type the referring entity belongs to: 1. workflow 2. agent",`created_at`bigintunsignedNOTNULLCOMMENT"create time in millisecond",`status`tinyintunsignedNOTNULLCOMMENT"whether this reference currently takes effect. 0: disabled 1: enabled",`deleted_at`datetime(3)NULLCOMMENT"Delete Time",PRIMARYKEY(`id`),INDEX`idx_referred_id_referring_biz_type_status`(`referred_id`,`referring_biz_type`,`status`),INDEX`idx_referring_id_status`(`referring_id`,`status`),UNIQUEINDEX`uniq_referred_id_referring_id_refer_type`(`referred_id`,`referring_id`,`refer_type`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"The workflow association table,used to record the direct mutual reference relationship between workflows";
-- Create "workflow_snapshot" table
CREATETABLEIFNOTEXISTS`workflow_snapshot`(`workflow_id`bigintunsignedNOTNULLCOMMENT"workflow id this snapshot belongs to",`commit_id`varchar(255)NOTNULLCOMMENT"the commit id of the workflow draft",`canvas`mediumtextNOTNULLCOMMENT"frontend schema for this snapshot",`input_params`mediumtextNULLCOMMENT"input parameter info",`output_params`mediumtextNULLCOMMENT"output parameter info",`created_at`bigintunsignedNOTNULLCOMMENT"Create Time in Milliseconds",`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"ID",PRIMARYKEY(`id`),UNIQUEINDEX`uniq_workflow_id_commit_id`(`workflow_id`,`commit_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"snapshot for executed workflow draft";
-- Create "workflow_version" table
CREATETABLEIFNOTEXISTS`workflow_version`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT"ID",`workflow_id`bigintunsignedNOTNULLCOMMENT"workflow id",`version`varchar(50)NOTNULLCOMMENT"Published version",`version_description`varchar(2000)NOTNULLCOMMENT"Version Description",`canvas`mediumtextNOTNULLCOMMENT"Front end schema",`input_params`mediumtextNULLCOMMENT"input params",`output_params`mediumtextNULLCOMMENT"output params",`creator_id`bigintunsignedNOTNULLCOMMENT"creator id",`created_at`bigintunsignedNOTNULLCOMMENT"Create Time in Milliseconds",`deleted_at`datetime(3)NULLCOMMENT"Delete Time",`commit_id`varchar(255)NOTNULLCOMMENT"the commit id corresponding to this version",PRIMARYKEY(`id`),INDEX`idx_id_created_at`(`workflow_id`,`created_at`),UNIQUEINDEX`uniq_workflow_id_version`(`workflow_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT"Workflow Canvas Version Information Table, used to record canvas information for different versions";
-- Create 'agent_to_database' table
CREATETABLEIFNOTEXISTS`agent_to_database`(`id`bigintunsignedNOTNULLCOMMENT'ID',`agent_id`bigintunsignedNOTNULLCOMMENT'Agent ID',`database_id`bigintunsignedNOTNULLCOMMENT'ID of database_info',`is_draft`boolNOTNULLCOMMENT'Is draft',`prompt_disable`boolNOTNULLDEFAULT0COMMENT'Support prompt calls: 1 not supported, 0 supported',PRIMARYKEY(`id`),UNIQUEINDEX`uniq_agent_db_draft`(`agent_id`,`database_id`,`is_draft`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT'agent_to_database info';
-- Create 'agent_tool_draft' table
CREATETABLEIFNOTEXISTS`agent_tool_draft`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Primary Key ID',`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Agent ID',`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Plugin ID',`tool_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Tool ID',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`sub_url`varchar(512)NOTNULLDEFAULT''COMMENT'Sub URL Path',`method`varchar(64)NOTNULLDEFAULT''COMMENT'HTTP Request Method',`tool_name`varchar(255)NOTNULLDEFAULT''COMMENT'Tool Name',`tool_version`varchar(255)NOTNULLDEFAULT''COMMENT'Tool Version, e.g. v1.0.0',`operation`jsonNULLCOMMENT'Tool Openapi Operation Schema',PRIMARYKEY(`id`),INDEX`idx_agent_plugin_tool`(`agent_id`,`plugin_id`,`tool_id`),INDEX`idx_agent_tool_bind`(`agent_id`,`created_at`),UNIQUEINDEX`uniq_idx_agent_tool_id`(`agent_id`,`tool_id`),UNIQUEINDEX`uniq_idx_agent_tool_name`(`agent_id`,`tool_name`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Draft Agent Tool';
-- Create 'agent_tool_version' table
CREATETABLEIFNOTEXISTS`agent_tool_version`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Primary Key ID',`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Agent ID',`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Plugin ID',`tool_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Tool ID',`agent_version`varchar(255)NOTNULLDEFAULT''COMMENT'Agent Tool Version',`tool_name`varchar(255)NOTNULLDEFAULT''COMMENT'Tool Name',`tool_version`varchar(255)NOTNULLDEFAULT''COMMENT'Tool Version, e.g. v1.0.0',`sub_url`varchar(512)NOTNULLDEFAULT''COMMENT'Sub URL Path',`method`varchar(64)NOTNULLDEFAULT''COMMENT'HTTP Request Method',`operation`jsonNULLCOMMENT'Tool Openapi Operation Schema',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',PRIMARYKEY(`id`),INDEX`idx_agent_tool_id_created_at`(`agent_id`,`tool_id`,`created_at`),INDEX`idx_agent_tool_name_created_at`(`agent_id`,`tool_name`,`created_at`),UNIQUEINDEX`uniq_idx_agent_tool_id_agent_version`(`agent_id`,`tool_id`,`agent_version`),UNIQUEINDEX`uniq_idx_agent_tool_name_agent_version`(`agent_id`,`tool_name`,`agent_version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Agent Tool Version';
-- Create 'api_key' table
CREATETABLEIFNOTEXISTS`api_key`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'Primary Key ID',`api_key`varchar(255)NOTNULLDEFAULT''COMMENT'API Key hash',`name`varchar(255)NOTNULLDEFAULT''COMMENT'API Key Name',`status`tinyintNOTNULLDEFAULT0COMMENT'0 normal, 1 deleted',`user_id`bigintNOTNULLDEFAULT0COMMENT'API Key Owner',`expired_at`bigintNOTNULLDEFAULT0COMMENT'API Key Expired Time',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`last_used_at`bigintNOTNULLDEFAULT0COMMENT'Used Time in Milliseconds',PRIMARYKEY(`id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'api key table';
-- Create 'app_connector_release_ref' table
CREATETABLEIFNOTEXISTS`app_connector_release_ref`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Primary Key',`record_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Publish Record ID',`connector_id`bigintunsignedNULLCOMMENT'Publish Connector ID',`publish_config`jsonNULLCOMMENT'Publish Configuration',`publish_status`tinyintNOTNULLDEFAULT0COMMENT'Publish Status',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',PRIMARYKEY(`id`),UNIQUEINDEX`uniq_record_connector`(`record_id`,`connector_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Connector Release Record Reference';
-- Create 'app_draft' table
CREATETABLEIFNOTEXISTS`app_draft`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'APP ID',`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Space ID',`owner_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Owner ID',`icon_uri`varchar(512)NOTNULLDEFAULT''COMMENT'Icon URI',`name`varchar(255)NOTNULLDEFAULT''COMMENT'Application Name',`description`textNULLCOMMENT'Application Description',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetimeNULLCOMMENT'Delete Time',PRIMARYKEY(`id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Draft Application';
-- Create 'app_release_record' table
CREATETABLEIFNOTEXISTS`app_release_record`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Publish Record ID',`app_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Application ID',`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Space ID',`owner_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Owner ID',`icon_uri`varchar(512)NOTNULLDEFAULT''COMMENT'Icon URI',`name`varchar(255)NOTNULLDEFAULT''COMMENT'Application Name',`description`textNULLCOMMENT'Application Description',`connector_ids`jsonNULLCOMMENT'Publish Connector IDs',`extra_info`jsonNULLCOMMENT'Publish Extra Info',`version`varchar(255)NOTNULLDEFAULT''COMMENT'Release Version',`version_desc`textNULLCOMMENT'Version Description',`publish_status`tinyintNOTNULLDEFAULT0COMMENT'Publish Status',`publish_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Publish Time in Milliseconds',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',PRIMARYKEY(`id`),INDEX`idx_app_publish_at`(`app_id`,`publish_at`),UNIQUEINDEX`uniq_idx_app_version_connector`(`app_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Application Release Record';
-- Create 'connector_workflow_version' table
CREATETABLEIFNOTEXISTS`connector_workflow_version`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'id',`app_id`bigintunsignedNOTNULLCOMMENT'app id',`connector_id`bigintunsignedNOTNULLCOMMENT'connector id',`workflow_id`bigintunsignedNOTNULLCOMMENT'workflow id',`version`varchar(256)NOTNULLCOMMENT'version',`created_at`bigintunsignedNOTNULLCOMMENT'create time in millisecond',PRIMARYKEY(`id`),INDEX`idx_connector_id_workflow_id_create_at`(`connector_id`,`workflow_id`,`created_at`),UNIQUEINDEX`uniq_connector_id_workflow_id_version`(`connector_id`,`workflow_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'connector workflow version';
-- Create 'conversation' table
CREATETABLEIFNOTEXISTS`conversation`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'id',`connector_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Publish Connector ID',`agent_id`bigintNOTNULLDEFAULT0COMMENT'agent_id',`scene`tinyintNOTNULLDEFAULT0COMMENT'conversation scene',`section_id`bigintunsignedNOTNULLDEFAULT0COMMENT'section_id',`creator_id`bigintunsignedNULLDEFAULT0COMMENT'creator_id',`ext`textNULLCOMMENT'ext',`status`tinyintNOTNULLDEFAULT1COMMENT'status: 1-normal 2-deleted',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',PRIMARYKEY(`id`),INDEX`idx_connector_bot_status`(`connector_id`,`agent_id`,`creator_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'conversation info record';
-- Create 'data_copy_task' table
CREATETABLEIFNOTEXISTS`data_copy_task`(`master_task_id`varchar(128)NULLDEFAULT''COMMENT'task id',`origin_data_id`bigintunsignedNOTNULLDEFAULT0COMMENT'origin data id',`target_data_id`bigintunsignedNOTNULLDEFAULT0COMMENT'target data id',`origin_space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'origin space id',`target_space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'target space id',`origin_user_id`bigintunsignedNOTNULLDEFAULT0COMMENT'origin user id',`target_user_id`bigintunsignedNULLDEFAULT0COMMENT'target user id',`origin_app_id`bigintunsignedNOTNULLDEFAULT0COMMENT'origin app id',`target_app_id`bigintunsignedNOTNULLDEFAULT0COMMENT'target app id',`data_type`tinyintunsignedNOTNULLDEFAULT0COMMENT'data type 1:knowledge, 2:database',`ext_info`varchar(255)NOTNULLDEFAULT''COMMENT'ext',`start_time`bigintNULLDEFAULT0COMMENT'task start time',`finish_time`bigintNULLCOMMENT'task finish time',`status`tinyintNOTNULLDEFAULT1COMMENT'1: Create 2: Running 3: Success 4: Failure',`error_msg`varchar(128)NULLCOMMENT'error msg',`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'ID',PRIMARYKEY(`id`),UNIQUEINDEX`uniq_master_task_id_origin_data_id_data_type`(`master_task_id`,`origin_data_id`,`data_type`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT'data copy task record';
-- Create 'draft_database_info' table
CREATETABLEIFNOTEXISTS`draft_database_info`(`id`bigintunsignedNOTNULLCOMMENT'ID',`app_id`bigintunsignedNULLCOMMENT'App ID',`space_id`bigintunsignedNOTNULLCOMMENT'Space ID',`related_online_id`bigintunsignedNOTNULLCOMMENT'The primary key ID of online_database_info table',`is_visible`tinyintNOTNULLDEFAULT1COMMENT'Visibility: 0 invisible, 1 visible',`prompt_disabled`tinyintNOTNULLDEFAULT0COMMENT'Support prompt calls: 1 not supported, 0 supported',`table_name`varchar(255)NOTNULLCOMMENT'Table name',`table_desc`varchar(256)NULLCOMMENT'Table description',`table_field`textNULLCOMMENT'Table field info',`creator_id`bigintNOTNULLDEFAULT0COMMENT'Creator ID',`icon_uri`varchar(255)NOTNULLCOMMENT'Icon Uri',`physical_table_name`varchar(255)NULLCOMMENT'The name of the real physical table',`rw_mode`bigintNOTNULLDEFAULT1COMMENT'Read and write permission modes: 1. Limited read and write mode 2. Read-only mode 3. Full read and write mode',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetimeNULLCOMMENT'Delete Time',PRIMARYKEY(`id`),INDEX`idx_space_app_creator_deleted`(`space_id`,`app_id`,`creator_id`,`deleted_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT'draft database info';
-- Create 'knowledge' table
CREATETABLEIFNOTEXISTS`knowledge`(`id`bigintunsignedNOTNULLCOMMENT'id',`name`varchar(150)NOTNULLDEFAULT''COMMENT'knowledge_s name',`app_id`bigintNOTNULLDEFAULT0COMMENT'app id',`creator_id`bigintunsignedNOTNULLDEFAULT0COMMENT'creator id',`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'space id',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetime(3)NULLCOMMENT'Delete Time',`status`tinyintNOTNULLDEFAULT1COMMENT'0 initialization, 1 effective, 2 invalid',`description`textNULLCOMMENT'description',`icon_uri`varchar(150)NULLCOMMENT'icon uri',`format_type`tinyintNOTNULLDEFAULT0COMMENT'0: Text 1: Table 2: Images',PRIMARYKEY(`id`),INDEX`idx_app_id`(`app_id`),INDEX`idx_creator_id`(`creator_id`),INDEX`idx_space_id_deleted_at_updated_at`(`space_id`,`deleted_at`,`updated_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'knowledge tabke';
-- Create 'knowledge_document' table
CREATETABLEIFNOTEXISTS`knowledge_document`(`id`bigintunsignedNOTNULLCOMMENT'id',`knowledge_id`bigintunsignedNOTNULLDEFAULT0COMMENT'knowledge id',`name`varchar(150)NOTNULLDEFAULT''COMMENT'document name',`file_extension`varchar(20)NOTNULLDEFAULT'0'COMMENT'Document type, txt/pdf/csv etc..',`document_type`intNOTNULLDEFAULT0COMMENT'Document type: 0: Text 1: Table 2: Image',`uri`textNULLCOMMENT'uri',`size`bigintunsignedNOTNULLDEFAULT0COMMENT'document size',`slice_count`bigintunsignedNOTNULLDEFAULT0COMMENT'slice count',`char_count`bigintunsignedNOTNULLDEFAULT0COMMENT'number of characters',`creator_id`bigintunsignedNOTNULLDEFAULT0COMMENT'creator id',`space_id`bigintNOTNULLDEFAULT0COMMENT'space id',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetime(3)NULLCOMMENT'Delete Time',`source_type`intNULLDEFAULT0COMMENT'0: Local file upload, 2: Custom text, 103: Feishu 104: Lark',`status`intNOTNULLDEFAULT0COMMENT'status',`fail_reason`textNULLCOMMENT'fail reason',`parse_rule`jsonNULLCOMMENT'parse rule',`table_info`jsonNULLCOMMENT'table info',PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`),INDEX`idx_knowledge_id_deleted_at_updated_at`(`knowledge_id`,`deleted_at`,`updated_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'knowledge document info';
-- Create 'knowledge_document_review' table
CREATETABLEIFNOTEXISTS`knowledge_document_review`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'id',`knowledge_id`bigintunsignedNOTNULLDEFAULT0COMMENT'knowledge id',`space_id`bigintNOTNULLDEFAULT0COMMENT'space id',`name`varchar(150)NOTNULLDEFAULT''COMMENT'name',`type`varchar(10)NOTNULLDEFAULT'0'COMMENT'document type',`uri`textNULLCOMMENT'uri',`format_type`tinyintunsignedNOTNULLDEFAULT0COMMENT'0 text, 1 table, 2 images',`status`tinyintunsignedNOTNULLDEFAULT0COMMENT'0 Processing 1 Completed 2 Failed 3 Expired',`chunk_resp_uri`textNULLCOMMENT'pre-sliced uri',`deleted_at`datetime(3)NULLCOMMENT'Delete Time',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`creator_id`bigintNOTNULLDEFAULT0COMMENT'creator id',PRIMARYKEY(`id`),INDEX`idx_dataset_id`(`knowledge_id`,`status`,`updated_at`),INDEX`idx_uri`(`uri`(100)))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Document slice preview info';
-- Create 'knowledge_document_slice' table
CREATETABLEIFNOTEXISTS`knowledge_document_slice`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'id',`knowledge_id`bigintunsignedNOTNULLDEFAULT0COMMENT'knowledge id',`document_id`bigintunsignedNOTNULLDEFAULT0COMMENT'document_id',`content`textNULLCOMMENT'content',`sequence`decimal(20,5)NOTNULLCOMMENT'slice sequence number, starting from 1',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetime(3)NULLCOMMENT'Delete Time',`creator_id`bigintNOTNULLDEFAULT0COMMENT'creator id',`space_id`bigintNOTNULLDEFAULT0COMMENT'space id',`status`intNOTNULLDEFAULT0COMMENT'status',`fail_reason`textNULLCOMMENT'fail reason',`hit`bigintunsignedNOTNULLDEFAULT0COMMENT'hit counts ',PRIMARYKEY(`id`),INDEX`idx_document_id_deleted_at_sequence`(`document_id`,`deleted_at`,`sequence`),INDEX`idx_knowledge_id_document_id`(`knowledge_id`,`document_id`),INDEX`idx_sequence`(`sequence`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'knowledge document slice';
-- Create 'message' table
CREATETABLEIFNOTEXISTS`message`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'id',`run_id`bigintunsignedNOTNULLDEFAULT0COMMENT'run_id',`conversation_id`bigintunsignedNOTNULLDEFAULT0COMMENT'conversation id',`user_id`varchar(60)NOTNULLDEFAULT''COMMENT'user id',`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT'agent_id',`role`varchar(100)NOTNULLDEFAULT''COMMENT'role: user、assistant、system',`content_type`varchar(100)NOTNULLDEFAULT''COMMENT'content type 1 text',`content`mediumtextNULLCOMMENT'content',`message_type`varchar(100)NOTNULLDEFAULT''COMMENT'message_type',`display_content`textNULLCOMMENT'display content',`ext`textNULLCOMMENT'message ext'COLLATEutf8mb4_general_ci,`section_id`bigintunsignedNULLCOMMENT'section_id',`broken_position`intNULLDEFAULT-1COMMENT'broken position',`status`tinyintunsignedNOTNULLDEFAULT0COMMENT'message status: 1 Available 2 Deleted 3 Replaced 4 Broken 5 Failed 6 Streaming 7 Pending',`model_content`mediumtextNULLCOMMENT'model content',`meta_info`textNULLCOMMENT'text tagging information such as citation and highlighting',`reasoning_content`textNULLCOMMENT'reasoning content'COLLATEutf8mb4_general_ci,`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',PRIMARYKEY(`id`),INDEX`idx_conversation_id`(`conversation_id`),INDEX`idx_run_id`(`run_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'message record';
-- Create 'model_entity' table
CREATETABLEIFNOTEXISTS`model_entity`(`id`bigintunsignedNOTNULLCOMMENT'id',`meta_id`bigintunsignedNOTNULLCOMMENT'model metadata id',`name`varchar(128)NOTNULLCOMMENT'name',`description`textNULLCOMMENT'description',`default_params`jsonNULLCOMMENT'default params',`scenario`bigintunsignedNOTNULLCOMMENT'scenario',`status`intNOTNULLDEFAULT1COMMENT'model status',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`bigintunsignedNULLCOMMENT'Delete Time',PRIMARYKEY(`id`),INDEX`idx_scenario`(`scenario`),INDEX`idx_status`(`status`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Model information';
-- Create 'model_meta' table
CREATETABLEIFNOTEXISTS`model_meta`(`id`bigintunsignedNOTNULLCOMMENT'id',`model_name`varchar(128)NOTNULLCOMMENT'model name',`protocol`varchar(128)NOTNULLCOMMENT'model protocol',`icon_uri`varchar(255)NOTNULLDEFAULT''COMMENT'Icon URI',`capability`jsonNULLCOMMENT'capability',`conn_config`jsonNULLCOMMENT'model conn config',`status`intNOTNULLDEFAULT1COMMENT'model status',`description`varchar(2048)NOTNULLDEFAULT''COMMENT'description',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`bigintunsignedNULLCOMMENT'Delete Time',`icon_url`varchar(255)NOTNULLDEFAULT''COMMENT'Icon URL',PRIMARYKEY(`id`),INDEX`idx_status`(`status`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Model metadata';
-- Create 'node_execution' table
CREATETABLEIFNOTEXISTS`node_execution`(`id`bigintunsignedNOTNULLCOMMENT'node execution id',`execute_id`bigintunsignedNOTNULLCOMMENT'the workflow execute id this node execution belongs to',`node_id`varchar(128)NOTNULLCOMMENT'node key'COLLATEutf8mb4_unicode_ci,`node_name`varchar(128)NOTNULLCOMMENT'name of the node'COLLATEutf8mb4_unicode_ci,`node_type`varchar(128)NOTNULLCOMMENT'the type of the node, in string'COLLATEutf8mb4_unicode_ci,`created_at`bigintunsignedNOTNULLCOMMENT'create time in millisecond',`status`tinyintunsignedNOTNULLCOMMENT'1=waiting 2=running 3=success 4=fail',`duration`bigintunsignedNULLCOMMENT'execution duration in millisecond',`input`mediumtextNULLCOMMENT'actual input of the node'COLLATEutf8mb4_unicode_ci,`output`mediumtextNULLCOMMENT'actual output of the node'COLLATEutf8mb4_unicode_ci,`raw_output`mediumtextNULLCOMMENT'the original output of the node'COLLATEutf8mb4_unicode_ci,`error_info`mediumtextNULLCOMMENT'error info'COLLATEutf8mb4_unicode_ci,`error_level`varchar(32)NULLCOMMENT'level of the error'COLLATEutf8mb4_unicode_ci,`input_tokens`bigintunsignedNULLCOMMENT'number of input tokens',`output_tokens`bigintunsignedNULLCOMMENT'number of output tokens',`updated_at`bigintunsignedNULLCOMMENT'update time in millisecond',`composite_node_index`bigintunsignedNULLCOMMENT'loop or batch_s execution index',`composite_node_items`mediumtextNULLCOMMENT'the items extracted from parent composite node for this index'COLLATEutf8mb4_unicode_ci,`parent_node_id`varchar(128)NULLCOMMENT'when as inner node for loop or batch, this is the parent node_s key'COLLATEutf8mb4_unicode_ci,`sub_execute_id`bigintunsignedNULLCOMMENT'if this node is sub_workflow, the exe id of the sub workflow',`extra`mediumtextNULLCOMMENT'extra info'COLLATEutf8mb4_unicode_ci,PRIMARYKEY(`id`),INDEX`idx_execute_id_node_id`(`execute_id`,`node_id`),INDEX`idx_execute_id_parent_node_id`(`execute_id`,`parent_node_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_0900_ai_ciCOMMENT'Node run record, used to record the status information of each node during each workflow execution';
-- Create 'online_database_info' table
CREATETABLEIFNOTEXISTS`online_database_info`(`id`bigintunsignedNOTNULLCOMMENT'ID',`app_id`bigintunsignedNULLCOMMENT'App ID',`space_id`bigintunsignedNOTNULLCOMMENT'Space ID',`related_draft_id`bigintunsignedNOTNULLCOMMENT'The primary key ID of draft_database_info table',`is_visible`tinyintNOTNULLDEFAULT1COMMENT'Visibility: 0 invisible, 1 visible',`prompt_disabled`tinyintNOTNULLDEFAULT0COMMENT'Support prompt calls: 1 not supported, 0 supported',`table_name`varchar(255)NOTNULLCOMMENT'Table name',`table_desc`varchar(256)NULLCOMMENT'Table description',`table_field`textNULLCOMMENT'Table field info',`creator_id`bigintNOTNULLDEFAULT0COMMENT'Creator ID',`icon_uri`varchar(255)NOTNULLCOMMENT'Icon Uri',`physical_table_name`varchar(255)NULLCOMMENT'The name of the real physical table',`rw_mode`bigintNOTNULLDEFAULT1COMMENT'Read and write permission modes: 1. Limited read and write mode 2. Read-only mode 3. Full read and write mode',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetimeNULLCOMMENT'Delete Time',PRIMARYKEY(`id`),INDEX`idx_space_app_creator_deleted`(`space_id`,`app_id`,`creator_id`,`deleted_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT'online database info';
-- Create 'plugin' table
CREATETABLEIFNOTEXISTS`plugin`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Plugin ID',`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Space ID',`developer_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Developer ID',`app_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Application ID',`icon_uri`varchar(512)NOTNULLDEFAULT''COMMENT'Icon URI',`server_url`varchar(512)NOTNULLDEFAULT''COMMENT'Server URL',`plugin_type`tinyintNOTNULLDEFAULT0COMMENT'Plugin Type, 1:http, 6:local',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`version`varchar(255)NOTNULLDEFAULT''COMMENT'Plugin Version, e.g. v1.0.0',`version_desc`textNULLCOMMENT'Plugin Version Description',`manifest`jsonNULLCOMMENT'Plugin Manifest',`openapi_doc`jsonNULLCOMMENT'OpenAPI Document, only stores the root',PRIMARYKEY(`id`),INDEX`idx_space_created_at`(`space_id`,`created_at`),INDEX`idx_space_updated_at`(`space_id`,`updated_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Latest Plugin';
-- Create 'plugin_draft' table
CREATETABLEIFNOTEXISTS`plugin_draft`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Plugin ID',`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Space ID',`developer_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Developer ID',`app_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Application ID',`icon_uri`varchar(512)NOTNULLDEFAULT''COMMENT'Icon URI',`server_url`varchar(512)NOTNULLDEFAULT''COMMENT'Server URL',`plugin_type`tinyintNOTNULLDEFAULT0COMMENT'Plugin Type, 1:http, 6:local',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetimeNULLCOMMENT'Delete Time',`manifest`jsonNULLCOMMENT'Plugin Manifest',`openapi_doc`jsonNULLCOMMENT'OpenAPI Document, only stores the root',PRIMARYKEY(`id`),INDEX`idx_app_id`(`app_id`,`id`),INDEX`idx_space_app_created_at`(`space_id`,`app_id`,`created_at`),INDEX`idx_space_app_updated_at`(`space_id`,`app_id`,`updated_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Draft Plugin';
-- Create 'plugin_oauth_auth' table
CREATETABLEIFNOTEXISTS`plugin_oauth_auth`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Primary Key',`user_id`varchar(255)NOTNULLDEFAULT''COMMENT'User ID',`plugin_id`bigintNOTNULLDEFAULT0COMMENT'Plugin ID',`is_draft`boolNOTNULLDEFAULT0COMMENT'Is Draft Plugin',`oauth_config`jsonNULLCOMMENT'Authorization Code OAuth Config',`access_token`textNULLCOMMENT'Access Token',`refresh_token`textNULLCOMMENT'Refresh Token',`token_expired_at`bigintNULLCOMMENT'Token Expired in Milliseconds',`next_token_refresh_at`bigintNULLCOMMENT'Next Token Refresh Time in Milliseconds',`last_active_at`bigintNULLCOMMENT'Last active time in Milliseconds',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',PRIMARYKEY(`id`),INDEX`idx_last_active_at`(`last_active_at`),INDEX`idx_last_token_expired_at`(`token_expired_at`),INDEX`idx_next_token_refresh_at`(`next_token_refresh_at`),UNIQUEINDEX`uniq_idx_user_plugin_is_draft`(`user_id`,`plugin_id`,`is_draft`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Plugin OAuth Authorization Code Info';
-- Create 'plugin_version' table
CREATETABLEIFNOTEXISTS`plugin_version`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Primary Key ID',`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Space ID',`developer_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Developer ID',`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Plugin ID',`app_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Application ID',`icon_uri`varchar(512)NOTNULLDEFAULT''COMMENT'Icon URI',`server_url`varchar(512)NOTNULLDEFAULT''COMMENT'Server URL',`plugin_type`tinyintNOTNULLDEFAULT0COMMENT'Plugin Type, 1:http, 6:local',`version`varchar(255)NOTNULLDEFAULT''COMMENT'Plugin Version, e.g. v1.0.0',`version_desc`textNULLCOMMENT'Plugin Version Description',`manifest`jsonNULLCOMMENT'Plugin Manifest',`openapi_doc`jsonNULLCOMMENT'OpenAPI Document, only stores the root',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`deleted_at`datetimeNULLCOMMENT'Delete Time',PRIMARYKEY(`id`),UNIQUEINDEX`uniq_idx_plugin_version`(`plugin_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Plugin Version';
-- Create 'prompt_resource' table
CREATETABLEIFNOTEXISTS`prompt_resource`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'id',`space_id`bigintNOTNULLCOMMENT'space id',`name`varchar(255)NOTNULLCOMMENT'name',`description`varchar(255)NOTNULLCOMMENT'description',`prompt_text`mediumtextNULLCOMMENT'prompt text',`status`intNOTNULLCOMMENT'status, 0 is invalid, 1 is valid',`creator_id`bigintNOTNULLCOMMENT'creator id',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_0900_ai_ciCOMMENT'prompt_resource';
-- Create 'run_record' table
CREATETABLEIFNOTEXISTS`run_record`(`id`bigintunsignedNOTNULLCOMMENT'id',`conversation_id`bigintunsignedNOTNULLDEFAULT0COMMENT'conversation id',`section_id`bigintunsignedNOTNULLDEFAULT0COMMENT'section ID',`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT'agent_id',`user_id`varchar(255)NOTNULLDEFAULT''COMMENT'user id',`source`tinyintunsignedNOTNULLDEFAULT0COMMENT'Execute source 0 API',`status`varchar(255)NOTNULLDEFAULT''COMMENT'status,0 Unknown, 1-Created,2-InProgress,3-Completed,4-Failed,5-Expired,6-Cancelled,7-RequiresAction',`creator_id`bigintNOTNULLDEFAULT0COMMENT'creator id',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`failed_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Fail Time in Milliseconds',`last_error`textNULLCOMMENT'error message'COLLATEutf8mb4_general_ci,`completed_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Finish Time in Milliseconds',`chat_request`textNULLCOMMENT'Original request field'COLLATEutf8mb4_general_ci,`ext`textNULLCOMMENT'ext'COLLATEutf8mb4_general_ci,`usage`jsonNULLCOMMENT'usage',PRIMARYKEY(`id`),INDEX`idx_c_s`(`conversation_id`,`section_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'run record';
-- Create 'shortcut_command' table
CREATETABLEIFNOTEXISTS`shortcut_command`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'id',`object_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Entity ID, this command can be used for this entity',`command_id`bigintunsignedNOTNULLDEFAULT0COMMENT'command id',`command_name`varchar(255)NOTNULLDEFAULT''COMMENT'command name',`shortcut_command`varchar(255)NOTNULLDEFAULT''COMMENT'shortcut command',`description`varchar(2000)NOTNULLDEFAULT''COMMENT'description',`send_type`tinyintunsignedNOTNULLDEFAULT0COMMENT'send type 0:query 1:panel',`tool_type`tinyintunsignedNOTNULLDEFAULT0COMMENT'Type 1 of tool used: WorkFlow 2: Plugin',`work_flow_id`bigintunsignedNOTNULLDEFAULT0COMMENT'workflow id',`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT'plugin id',`plugin_tool_name`varchar(255)NOTNULLDEFAULT''COMMENT'plugin tool name',`template_query`textNULLCOMMENT'template query',`components`jsonNULLCOMMENT'Panel parameters',`card_schema`textNULLCOMMENT'card schema',`tool_info`jsonNULLCOMMENT'Tool information includes name+variable list',`status`tinyintunsignedNOTNULLDEFAULT0COMMENT'Status, 0 is invalid, 1 is valid',`creator_id`bigintunsignedNULLDEFAULT0COMMENT'creator id',`is_online`tinyintunsignedNOTNULLDEFAULT0COMMENT'Is online information: 0 draft 1 online',`created_at`bigintNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT'When executing a multi instruction, which node executes the instruction',`shortcut_icon`jsonNULLCOMMENT'shortcut icon',`plugin_tool_id`bigintNOTNULLDEFAULT0COMMENT'tool_id',PRIMARYKEY(`id`),UNIQUEINDEX`uniq_object_command_id_type`(`object_id`,`command_id`,`is_online`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_general_ciCOMMENT'bot shortcut command table';
-- Create 'single_agent_draft' table
CREATETABLEIFNOTEXISTS`single_agent_draft`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'Primary Key ID',`agent_id`bigintNOTNULLDEFAULT0COMMENT'Agent ID',`creator_id`bigintNOTNULLDEFAULT0COMMENT'Creator ID',`space_id`bigintNOTNULLDEFAULT0COMMENT'Space ID',`name`varchar(255)NOTNULLDEFAULT''COMMENT'Agent Name',`description`textNULLCOMMENT'Agent Description',`icon_uri`varchar(255)NOTNULLDEFAULT''COMMENT'Icon URI',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetime(3)NULLCOMMENT'delete time in millisecond',`variables_meta_id`bigintNULLCOMMENT'variables meta table ID',`model_info`jsonNULLCOMMENT'Model Configuration Information',`onboarding_info`jsonNULLCOMMENT'Onboarding Information',`prompt`jsonNULLCOMMENT'Agent Prompt Configuration',`plugin`jsonNULLCOMMENT'Agent Plugin Base Configuration',`knowledge`jsonNULLCOMMENT'Agent Knowledge Base Configuration',`workflow`jsonNULLCOMMENT'Agent Workflow Configuration',`suggest_reply`jsonNULLCOMMENT'Suggested Replies',`jump_config`jsonNULLCOMMENT'Jump Configuration',`background_image_info_list`jsonNULLCOMMENT'Background image',`database_config`jsonNULLCOMMENT'Agent Database Base Configuration',`shortcut_command`jsonNULLCOMMENT'shortcut command',PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`),UNIQUEINDEX`uniq_agent_id`(`agent_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Single Agent Draft Copy Table';
-- Create 'single_agent_publish' table
CREATETABLEIFNOTEXISTS`single_agent_publish`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'id',`agent_id`bigintunsignedNOTNULLDEFAULT0COMMENT'agent_id',`publish_id`varchar(50)NOTNULLDEFAULT''COMMENT'publish id'COLLATEutf8mb4_general_ci,`connector_ids`jsonNULLCOMMENT'connector_ids',`version`varchar(255)NOTNULLDEFAULT''COMMENT'Agent Version',`publish_info`textNULLCOMMENT'publish info'COLLATEutf8mb4_general_ci,`publish_time`bigintunsignedNOTNULLDEFAULT0COMMENT'publish time',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`creator_id`bigintunsignedNOTNULLDEFAULT0COMMENT'creator id',`status`tinyintNOTNULLDEFAULT0COMMENT'Status 0: In use 1: Delete 3: Disabled',`extra`jsonNULLCOMMENT'extra',PRIMARYKEY(`id`),INDEX`idx_agent_id_version`(`agent_id`,`version`),INDEX`idx_creator_id`(`creator_id`),INDEX`idx_publish_id`(`publish_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Bot connector and release version info';
-- Create 'single_agent_version' table
CREATETABLEIFNOTEXISTS`single_agent_version`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'Primary Key ID',`agent_id`bigintNOTNULLDEFAULT0COMMENT'Agent ID',`creator_id`bigintNOTNULLDEFAULT0COMMENT'Creator ID',`space_id`bigintNOTNULLDEFAULT0COMMENT'Space ID',`name`varchar(255)NOTNULLDEFAULT''COMMENT'Agent Name',`description`textNULLCOMMENT'Agent Description',`icon_uri`varchar(255)NOTNULLDEFAULT''COMMENT'Icon URI',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`deleted_at`datetime(3)NULLCOMMENT'delete time in millisecond',`variables_meta_id`bigintNULLCOMMENT'variables meta table ID',`model_info`jsonNULLCOMMENT'Model Configuration Information',`onboarding_info`jsonNULLCOMMENT'Onboarding Information',`prompt`jsonNULLCOMMENT'Agent Prompt Configuration',`plugin`jsonNULLCOMMENT'Agent Plugin Base Configuration',`knowledge`jsonNULLCOMMENT'Agent Knowledge Base Configuration',`workflow`jsonNULLCOMMENT'Agent Workflow Configuration',`suggest_reply`jsonNULLCOMMENT'Suggested Replies',`jump_config`jsonNULLCOMMENT'Jump Configuration',`connector_id`bigintunsignedNOTNULLCOMMENT'Connector ID',`version`varchar(255)NOTNULLDEFAULT''COMMENT'Agent Version',`background_image_info_list`jsonNULLCOMMENT'Background image',`database_config`jsonNULLCOMMENT'Agent Database Base Configuration',`shortcut_command`jsonNULLCOMMENT'shortcut command',PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`),UNIQUEINDEX`uniq_agent_id_and_version_connector_id`(`agent_id`,`version`,`connector_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Single Agent Version Copy Table';
-- Create 'space' table
CREATETABLEIFNOTEXISTS`space`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'Primary Key ID, Space ID',`owner_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Owner ID',`name`varchar(200)NOTNULLDEFAULT''COMMENT'Space Name',`description`varchar(2000)NOTNULLDEFAULT''COMMENT'Space Description',`icon_uri`varchar(200)NOTNULLDEFAULT''COMMENT'Icon URI',`creator_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Creator ID',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Creation Time (Milliseconds)',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time (Milliseconds)',`deleted_at`bigintunsignedNULLCOMMENT'Deletion Time (Milliseconds)',PRIMARYKEY(`id`),INDEX`idx_creator_id`(`creator_id`),INDEX`idx_owner_id`(`owner_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Space Table';
-- Create 'space_user' table
CREATETABLEIFNOTEXISTS`space_user`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'Primary Key ID, Auto Increment',`space_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Space ID',`user_id`bigintunsignedNOTNULLDEFAULT0COMMENT'User ID',`role_type`intNOTNULLDEFAULT3COMMENT'Role Type: 1.owner 2.admin 3.member',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Creation Time (Milliseconds)',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time (Milliseconds)',PRIMARYKEY(`id`),INDEX`idx_user_id`(`user_id`),UNIQUEINDEX`uniq_space_user`(`space_id`,`user_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Space Member Table';
-- Create 'template' table
CREATETABLEIFNOTEXISTS`template`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'Primary Key ID',`agent_id`bigintNOTNULLDEFAULT0COMMENT'Agent ID',`workflow_id`bigintNOTNULLDEFAULT0COMMENT'Workflow ID',`space_id`bigintNOTNULLDEFAULT0COMMENT'Space ID',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`heat`bigintunsignedNOTNULLDEFAULT0COMMENT'Heat',`product_entity_type`bigintunsignedNOTNULLDEFAULT0COMMENT'Product Entity Type',`meta_info`jsonNULLCOMMENT'Meta Info',`agent_extra`jsonNULLCOMMENT'Agent Extra Info',`workflow_extra`jsonNULLCOMMENT'Workflow Extra Info',`project_extra`jsonNULLCOMMENT'Project Extra Info',PRIMARYKEY(`id`),UNIQUEINDEX`uniq_agent_id`(`agent_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Template Info Table';
-- Create 'tool' table
CREATETABLEIFNOTEXISTS`tool`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Tool ID',`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Plugin ID',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`version`varchar(255)NOTNULLDEFAULT''COMMENT'Tool Version, e.g. v1.0.0',`sub_url`varchar(512)NOTNULLDEFAULT''COMMENT'Sub URL Path',`method`varchar(64)NOTNULLDEFAULT''COMMENT'HTTP Request Method',`operation`jsonNULLCOMMENT'Tool Openapi Operation Schema',`activated_status`tinyintunsignedNOTNULLDEFAULT0COMMENT'0:activated; 1:deactivated',PRIMARYKEY(`id`),INDEX`idx_plugin_activated_status`(`plugin_id`,`activated_status`),UNIQUEINDEX`uniq_idx_plugin_sub_url_method`(`plugin_id`,`sub_url`,`method`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Latest Tool';
-- Create 'tool_draft' table
CREATETABLEIFNOTEXISTS`tool_draft`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Tool ID',`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Plugin ID',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`sub_url`varchar(512)NOTNULLDEFAULT''COMMENT'Sub URL Path',`method`varchar(64)NOTNULLDEFAULT''COMMENT'HTTP Request Method',`operation`jsonNULLCOMMENT'Tool Openapi Operation Schema',`debug_status`tinyintunsignedNOTNULLDEFAULT0COMMENT'0:not pass; 1:pass',`activated_status`tinyintunsignedNOTNULLDEFAULT0COMMENT'0:activated; 1:deactivated',PRIMARYKEY(`id`),INDEX`idx_plugin_created_at_id`(`plugin_id`,`created_at`,`id`),UNIQUEINDEX`uniq_idx_plugin_sub_url_method`(`plugin_id`,`sub_url`,`method`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Draft Tool';
-- Create 'tool_version' table
CREATETABLEIFNOTEXISTS`tool_version`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'Primary Key ID',`tool_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Tool ID',`plugin_id`bigintunsignedNOTNULLDEFAULT0COMMENT'Plugin ID',`version`varchar(255)NOTNULLDEFAULT''COMMENT'Tool Version, e.g. v1.0.0',`sub_url`varchar(512)NOTNULLDEFAULT''COMMENT'Sub URL Path',`method`varchar(64)NOTNULLDEFAULT''COMMENT'HTTP Request Method',`operation`jsonNULLCOMMENT'Tool Openapi Operation Schema',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`deleted_at`datetimeNULLCOMMENT'Delete Time',PRIMARYKEY(`id`),UNIQUEINDEX`uniq_idx_tool_version`(`tool_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Tool Version';
-- Create 'user' table
CREATETABLEIFNOTEXISTS`user`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'Primary Key ID',`name`varchar(128)NOTNULLDEFAULT''COMMENT'User Nickname',`unique_name`varchar(128)NOTNULLDEFAULT''COMMENT'User Unique Name',`email`varchar(128)NOTNULLDEFAULT''COMMENT'Email',`password`varchar(128)NOTNULLDEFAULT''COMMENT'Password (Encrypted)',`description`varchar(512)NOTNULLDEFAULT''COMMENT'User Description',`icon_uri`varchar(512)NOTNULLDEFAULT''COMMENT'Avatar URI',`user_verified`boolNOTNULLDEFAULT0COMMENT'User Verification Status',`locale`varchar(128)NOTNULLDEFAULT''COMMENT'Locale',`session_key`varchar(256)NOTNULLDEFAULT''COMMENT'Session Key',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Creation Time (Milliseconds)',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time (Milliseconds)',`deleted_at`bigintunsignedNULLCOMMENT'Deletion Time (Milliseconds)',PRIMARYKEY(`id`),INDEX`idx_session_key`(`session_key`),UNIQUEINDEX`uniq_email`(`email`),UNIQUEINDEX`uniq_unique_name`(`unique_name`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'User Table';
-- Create 'variable_instance' table
CREATETABLEIFNOTEXISTS`variable_instance`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'id',`biz_type`tinyintunsignedNOTNULLCOMMENT'1 for agent,2 for app',`biz_id`varchar(128)NOTNULLDEFAULT''COMMENT'1 for agent_id,2 for app_id',`version`varchar(255)NOTNULLCOMMENT'agent or project version empty represents draft status',`keyword`varchar(255)NOTNULLCOMMENT'Keyword to Memory',`type`tinyintNOTNULLCOMMENT'Memory type 1 KV 2 list',`content`textNULLCOMMENT'content',`connector_uid`varchar(255)NOTNULLCOMMENT'connector_uid',`connector_id`bigintNOTNULLCOMMENT'connector_id, e.g. coze = 10000010',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',PRIMARYKEY(`id`),INDEX`idx_connector_key`(`biz_id`,`biz_type`,`version`,`connector_uid`,`connector_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_0900_ai_ciCOMMENT'KV Memory';
-- Create 'variables_meta' table
CREATETABLEIFNOTEXISTS`variables_meta`(`id`bigintunsignedNOTNULLDEFAULT0COMMENT'id',`creator_id`bigintunsignedNOTNULLCOMMENT'creator id',`biz_type`tinyintunsignedNOTNULLCOMMENT'1 for agent,2 for app',`biz_id`varchar(128)NOTNULLDEFAULT''COMMENT'1 for agent_id,2 for app_id',`variable_list`jsonNULLCOMMENT'JSON data for variable configuration',`created_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Create Time in Milliseconds',`updated_at`bigintunsignedNOTNULLDEFAULT0COMMENT'Update Time in Milliseconds',`version`varchar(255)NOTNULLCOMMENT'Project version, empty represents draft status',PRIMARYKEY(`id`),INDEX`idx_user_key`(`creator_id`),UNIQUEINDEX`uniq_project_key`(`biz_id`,`biz_type`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_0900_ai_ciCOMMENT'KV Memory meta';
-- Create 'workflow_draft' table
CREATETABLEIFNOTEXISTS`workflow_draft`(`id`bigintunsignedNOTNULLCOMMENT'workflow ID',`canvas`mediumtextNULLCOMMENT'Front end schema',`input_params`mediumtextNULLCOMMENT'Input schema',`output_params`mediumtextNULLCOMMENT'Output parameter schema',`test_run_success`boolNOTNULLDEFAULT0COMMENT'0 not running, 1 running successfully',`modified`boolNOTNULLDEFAULT0COMMENT'0 has not been modified, 1 has been modified',`updated_at`bigintunsignedNULLCOMMENT'Update Time in Milliseconds',`deleted_at`datetime(3)NULLCOMMENT'Delete Time',`commit_id`varchar(255)NOTNULLCOMMENT'used to uniquely identify a draft snapshot',PRIMARYKEY(`id`),INDEX`idx_updated_at`(`updated_at`DESC))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Workflow canvas draft table, used to record the latest draft canvas information of workflow';
-- Create 'workflow_execution' table
CREATETABLEIFNOTEXISTS`workflow_execution`(`id`bigintunsignedNOTNULLCOMMENT'execute id',`workflow_id`bigintunsignedNOTNULLCOMMENT'workflow_id',`version`varchar(50)NULLCOMMENT'workflow version. empty if is draft',`space_id`bigintunsignedNOTNULLCOMMENT'the space id the workflow belongs to',`mode`tinyintunsignedNOTNULLCOMMENT'the execution mode: 1. debug run 2. release run 3. node debug',`operator_id`bigintunsignedNOTNULLCOMMENT'the user id that runs this workflow',`connector_id`bigintunsignedNULLCOMMENT'the connector on which this execution happened',`connector_uid`varchar(64)NULLCOMMENT'user id of the connector',`created_at`bigintunsignedNOTNULLCOMMENT'create time in millisecond',`log_id`varchar(128)NULLCOMMENT'log id',`status`tinyintunsignedNULLCOMMENT'1=running 2=success 3=fail 4=interrupted',`duration`bigintunsignedNULLCOMMENT'execution duration in millisecond',`input`mediumtextNULLCOMMENT'actual input of this execution',`output`mediumtextNULLCOMMENT'the actual output of this execution',`error_code`varchar(255)NULLCOMMENT'error code if any',`fail_reason`mediumtextNULLCOMMENT'the reason for failure',`input_tokens`bigintunsignedNULLCOMMENT'number of input tokens',`output_tokens`bigintunsignedNULLCOMMENT'number of output tokens',`updated_at`bigintunsignedNULLCOMMENT'update time in millisecond',`root_execution_id`bigintunsignedNULLCOMMENT'the top level execution id. Null if this is the root',`parent_node_id`varchar(128)NULLCOMMENT'the node key for the sub_workflow node that executes this workflow',`app_id`bigintunsignedNULLCOMMENT'app id this workflow execution belongs to',`node_count`mediumintunsignedNULLCOMMENT'the total node count of the workflow',`resume_event_id`bigintunsignedNULLCOMMENT'the current event ID which is resuming',`agent_id`bigintunsignedNULLCOMMENT'the agent that this execution binds to',`sync_pattern`tinyintunsignedNULLCOMMENT'the sync pattern 1. sync 2. async 3. stream',`commit_id`varchar(255)NULLCOMMENT'draft commit id this execution belongs to',PRIMARYKEY(`id`),INDEX`idx_workflow_id_version_mode_created_at`(`workflow_id`,`version`,`mode`,`created_at`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Workflow Execution Record Table, used to record the status of each workflow execution';
-- Create 'workflow_meta' table
CREATETABLEIFNOTEXISTS`workflow_meta`(`id`bigintunsignedNOTNULLCOMMENT'workflow id',`name`varchar(256)NOTNULLCOMMENT'workflow name',`description`varchar(2000)NOTNULLCOMMENT'workflow description',`icon_uri`varchar(256)NOTNULLCOMMENT'icon uri',`status`tinyintunsignedNOTNULLCOMMENT'0: Not published, 1: Published',`content_type`tinyintunsignedNOTNULLCOMMENT'0 Users 1 Official',`mode`tinyintunsignedNOTNULLCOMMENT'0:workflow, 3:chat_flow',`created_at`bigintunsignedNOTNULLCOMMENT'create time in millisecond',`updated_at`bigintunsignedNULLCOMMENT'update time in millisecond',`deleted_at`datetime(3)NULLCOMMENT'delete time in millisecond',`creator_id`bigintunsignedNOTNULLCOMMENT'user id for creator',`tag`tinyintunsignedNULLCOMMENT'template tag: Tag: 1=All, 2=Hot, 3=Information, 4=Music, 5=Picture, 6=UtilityTool, 7=Life, 8=Traval, 9=Network, 10=System, 11=Movie, 12=Office, 13=Shopping, 14=Education, 15=Health, 16=Social, 17=Entertainment, 18=Finance, 100=Hidden',`author_id`bigintunsignedNOTNULLCOMMENT'Original author user ID',`space_id`bigintunsignedNOTNULLCOMMENT'space id',`updater_id`bigintunsignedNULLCOMMENT'User ID for updating metadata',`source_id`bigintunsignedNULLCOMMENT'Workflow ID of source',`app_id`bigintunsignedNULLCOMMENT'app id',`latest_version`varchar(50)NULLCOMMENT'the version of the most recent publish',`latest_version_ts`bigintunsignedNULLCOMMENT'create time of latest version',PRIMARYKEY(`id`),INDEX`idx_app_id`(`app_id`),INDEX`idx_latest_version_ts`(`latest_version_ts`DESC),INDEX`idx_space_id_app_id_status_latest_version_ts`(`space_id`,`app_id`,`status`,`latest_version_ts`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'The workflow metadata table,used to record the basic metadata of workflow';
-- Create 'workflow_reference' table
CREATETABLEIFNOTEXISTS`workflow_reference`(`id`bigintunsignedNOTNULLCOMMENT'workflow id',`referred_id`bigintunsignedNOTNULLCOMMENT'the id of the workflow that is referred by other entities',`referring_id`bigintunsignedNOTNULLCOMMENT'the entity id that refers this workflow',`refer_type`tinyintunsignedNOTNULLCOMMENT'1 subworkflow 2 tool',`referring_biz_type`tinyintunsignedNOTNULLCOMMENT'the biz type the referring entity belongs to: 1. workflow 2. agent',`created_at`bigintunsignedNOTNULLCOMMENT'create time in millisecond',`status`tinyintunsignedNOTNULLCOMMENT'whether this reference currently takes effect. 0: disabled 1: enabled',`deleted_at`datetime(3)NULLCOMMENT'Delete Time',PRIMARYKEY(`id`),INDEX`idx_referred_id_referring_biz_type_status`(`referred_id`,`referring_biz_type`,`status`),INDEX`idx_referring_id_status`(`referring_id`,`status`),UNIQUEINDEX`uniq_referred_id_referring_id_refer_type`(`referred_id`,`referring_id`,`refer_type`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'The workflow association table,used to record the direct mutual reference relationship between workflows';
-- Create 'workflow_snapshot' table
CREATETABLEIFNOTEXISTS`workflow_snapshot`(`workflow_id`bigintunsignedNOTNULLCOMMENT'workflow id this snapshot belongs to',`commit_id`varchar(255)NOTNULLCOMMENT'the commit id of the workflow draft',`canvas`mediumtextNULLCOMMENT'frontend schema for this snapshot',`input_params`mediumtextNULLCOMMENT'input parameter info',`output_params`mediumtextNULLCOMMENT'output parameter info',`created_at`bigintunsignedNOTNULLCOMMENT'Create Time in Milliseconds',`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'ID',PRIMARYKEY(`id`),UNIQUEINDEX`uniq_workflow_id_commit_id`(`workflow_id`,`commit_id`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'snapshot for executed workflow draft';
-- Create 'workflow_version' table
CREATETABLEIFNOTEXISTS`workflow_version`(`id`bigintunsignedNOTNULLAUTO_INCREMENTCOMMENT'ID',`workflow_id`bigintunsignedNOTNULLCOMMENT'workflow id',`version`varchar(50)NOTNULLCOMMENT'Published version',`version_description`varchar(2000)NOTNULLCOMMENT'Version Description',`canvas`mediumtextNULLCOMMENT'Front end schema',`input_params`mediumtextNULLCOMMENT'input params',`output_params`mediumtextNULLCOMMENT'output params',`creator_id`bigintunsignedNOTNULLCOMMENT'creator id',`created_at`bigintunsignedNOTNULLCOMMENT'Create Time in Milliseconds',`deleted_at`datetime(3)NULLCOMMENT'Delete Time',`commit_id`varchar(255)NOTNULLCOMMENT'the commit id corresponding to this version',PRIMARYKEY(`id`),INDEX`idx_id_created_at`(`workflow_id`,`created_at`),UNIQUEINDEX`uniq_workflow_id_version`(`workflow_id`,`version`))ENGINE=InnoDBCHARSETutf8mb4COLLATEutf8mb4_unicode_ciCOMMENT'Workflow Canvas Version Information Table, used to record canvas information for different versions';
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.