|
|
|
|
@ -11,23 +11,23 @@ CREATE TABLE IF NOT EXISTS `api_key` (`id` bigint unsigned NOT NULL AUTO_INCREME
|
|
|
|
|
-- Create 'app_connector_release_ref' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_connector_release_ref` (`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Primary Key', `record_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Publish Record ID', `connector_id` bigint unsigned NULL COMMENT 'Publish Connector ID', `publish_config` json NULL COMMENT 'Publish Configuration', `publish_status` tinyint NOT NULL DEFAULT 0 COMMENT 'Publish Status', `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Create Time in Milliseconds', `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Update Time in Milliseconds', PRIMARY KEY (`id`), UNIQUE INDEX `uniq_record_connector` (`record_id`, `connector_id`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'Connector Release Record Reference';
|
|
|
|
|
-- Create 'app_conversation_template_draft' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_conversation_template_draft` (`id` bigint unsigned NOT NULL COMMENT `id`, `app_id` bigint unsigned NOT NULL COMMENT `app id`, `space_id` bigint unsigned NOT NULL COMMENT `space id`, `name` varchar(256) NOT NULL COMMENT `conversation name`, `template_id` bigint unsigned NOT NULL COMMENT `template id`, `creator_id` bigint unsigned NOT NULL COMMENT `creator id`, `created_at` bigint unsigned NOT NULL COMMENT `create time in millisecond`, `updated_at` bigint unsigned NULL COMMENT `update time in millisecond`, `deleted_at` datetime(3) NULL COMMENT `delete time in millisecond`, PRIMARY KEY (`id`), INDEX `idx_space_id_app_id_template_id` (`space_id`, `app_id`, `template_id`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_conversation_template_draft` (`id` bigint unsigned NOT NULL COMMENT 'id', `app_id` bigint unsigned NOT NULL COMMENT 'app id', `space_id` bigint unsigned NOT NULL COMMENT 'space id', `name` varchar(256) NOT NULL COMMENT 'conversation name', `template_id` bigint unsigned NOT NULL COMMENT 'template id', `creator_id` bigint unsigned NOT NULL COMMENT 'creator id', `created_at` bigint unsigned NOT NULL COMMENT 'create time in millisecond', `updated_at` bigint unsigned NULL COMMENT 'update time in millisecond', `deleted_at` datetime(3) NULL COMMENT 'delete time in millisecond', PRIMARY KEY (`id`), INDEX `idx_space_id_app_id_template_id` (`space_id`, `app_id`, `template_id`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
-- Create 'app_conversation_template_online' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_conversation_template_online` (`id` bigint unsigned NOT NULL COMMENT `id`, `app_id` bigint unsigned NOT NULL COMMENT `app id`, `space_id` bigint unsigned NOT NULL COMMENT `space id`, `name` varchar(256) NOT NULL COMMENT `conversation name`, `template_id` bigint unsigned NOT NULL COMMENT `template id`, `version` varchar(256) NOT NULL COMMENT `version name`, `creator_id` bigint unsigned NOT NULL COMMENT `creator id`, `created_at` bigint unsigned NOT NULL COMMENT `create time in millisecond`, PRIMARY KEY (`id`), INDEX `idx_space_id_app_id_template_id_version` (`space_id`, `app_id`, `template_id`, `version`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_conversation_template_online` (`id` bigint unsigned NOT NULL COMMENT 'id', `app_id` bigint unsigned NOT NULL COMMENT 'app id', `space_id` bigint unsigned NOT NULL COMMENT 'space id', `name` varchar(256) NOT NULL COMMENT 'conversation name', `template_id` bigint unsigned NOT NULL COMMENT 'template id', `version` varchar(256) NOT NULL COMMENT 'version name', `creator_id` bigint unsigned NOT NULL COMMENT 'creator id', `created_at` bigint unsigned NOT NULL COMMENT 'create time in millisecond', PRIMARY KEY (`id`), INDEX `idx_space_id_app_id_template_id_version` (`space_id`, `app_id`, `template_id`, `version`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
-- Create 'app_draft' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_draft` (`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'APP ID', `space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Space ID', `owner_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner ID', `icon_uri` varchar(512) NOT NULL DEFAULT '' COMMENT 'Icon URI', `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Application Name', `description` text NULL COMMENT 'Application Description', `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Create Time in Milliseconds', `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Update Time in Milliseconds', `deleted_at` datetime NULL COMMENT 'Delete Time', PRIMARY KEY (`id`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'Draft Application';
|
|
|
|
|
-- Create 'app_dynamic_conversation_draft' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_dynamic_conversation_draft` (`id` bigint unsigned NOT NULL COMMENT `id`, `app_id` bigint unsigned NOT NULL COMMENT `app id`, `name` varchar(256) NOT NULL COMMENT `conversation name`, `user_id` bigint unsigned NOT NULL COMMENT `user id`, `connector_id` bigint unsigned NOT NULL COMMENT `connector id`, `conversation_id` bigint unsigned NOT NULL COMMENT `conversation id`, `created_at` bigint unsigned NOT NULL COMMENT `create time in millisecond`, `deleted_at` datetime(3) NULL COMMENT `delete time in millisecond`, PRIMARY KEY (`id`), INDEX `idx_app_id_connector_id_user_id` (`app_id`, `connector_id`, `user_id`), INDEX `idx_connector_id_user_id_name` (`connector_id`, `user_id`, `name`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_dynamic_conversation_draft` (`id` bigint unsigned NOT NULL COMMENT 'id', `app_id` bigint unsigned NOT NULL COMMENT 'app id', `name` varchar(256) NOT NULL COMMENT 'conversation name', `user_id` bigint unsigned NOT NULL COMMENT 'user id', `connector_id` bigint unsigned NOT NULL COMMENT 'connector id', `conversation_id` bigint unsigned NOT NULL COMMENT 'conversation id', `created_at` bigint unsigned NOT NULL COMMENT 'create time in millisecond', `deleted_at` datetime(3) NULL COMMENT 'delete time in millisecond', PRIMARY KEY (`id`), INDEX `idx_app_id_connector_id_user_id` (`app_id`, `connector_id`, `user_id`), INDEX `idx_connector_id_user_id_name` (`connector_id`, `user_id`, `name`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
-- Create 'app_dynamic_conversation_online' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_dynamic_conversation_online` (`id` bigint unsigned NOT NULL COMMENT `id`, `app_id` bigint unsigned NOT NULL COMMENT `app id`, `name` varchar(256) NOT NULL COMMENT `conversation name`, `user_id` bigint unsigned NOT NULL COMMENT `user id`, `connector_id` bigint unsigned NOT NULL COMMENT `connector id`, `conversation_id` bigint unsigned NOT NULL COMMENT `conversation id`, `created_at` bigint unsigned NOT NULL COMMENT `create time in millisecond`, `deleted_at` datetime(3) NULL COMMENT `delete time in millisecond`, PRIMARY KEY (`id`), INDEX `idx_app_id_connector_id_user_id` (`app_id`, `connector_id`, `user_id`), INDEX `idx_connector_id_user_id_name` (`connector_id`, `user_id`, `name`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_dynamic_conversation_online` (`id` bigint unsigned NOT NULL COMMENT 'id', `app_id` bigint unsigned NOT NULL COMMENT 'app id', `name` varchar(256) NOT NULL COMMENT 'conversation name', `user_id` bigint unsigned NOT NULL COMMENT 'user id', `connector_id` bigint unsigned NOT NULL COMMENT 'connector id', `conversation_id` bigint unsigned NOT NULL COMMENT 'conversation id', `created_at` bigint unsigned NOT NULL COMMENT 'create time in millisecond', `deleted_at` datetime(3) NULL COMMENT 'delete time in millisecond', PRIMARY KEY (`id`), INDEX `idx_app_id_connector_id_user_id` (`app_id`, `connector_id`, `user_id`), INDEX `idx_connector_id_user_id_name` (`connector_id`, `user_id`, `name`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
-- Create 'app_release_record' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_release_record` (`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Publish Record ID', `app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Application ID', `space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Space ID', `owner_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner ID', `icon_uri` varchar(512) NOT NULL DEFAULT '' COMMENT 'Icon URI', `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Application Name', `description` text NULL COMMENT 'Application Description', `connector_ids` json NULL COMMENT 'Publish Connector IDs', `extra_info` json NULL COMMENT 'Publish Extra Info', `version` varchar(255) NOT NULL DEFAULT '' COMMENT 'Release Version', `version_desc` text NULL COMMENT 'Version Description', `publish_status` tinyint NOT NULL DEFAULT 0 COMMENT 'Publish Status', `publish_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Publish Time in Milliseconds', `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Create Time in Milliseconds', `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'Update Time in Milliseconds', PRIMARY KEY (`id`), INDEX `idx_app_publish_at` (`app_id`, `publish_at`), UNIQUE INDEX `uniq_idx_app_version_connector` (`app_id`, `version`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'Application Release Record';
|
|
|
|
|
-- Create 'app_static_conversation_draft' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_static_conversation_draft` (`id` bigint unsigned NOT NULL COMMENT `id`, `template_id` bigint unsigned NOT NULL COMMENT `template id`, `user_id` bigint unsigned NOT NULL COMMENT `user id`, `connector_id` bigint unsigned NOT NULL COMMENT `connector id`, `conversation_id` bigint unsigned NOT NULL COMMENT `conversation id`, `created_at` bigint unsigned NOT NULL COMMENT `create time in millisecond`, `deleted_at` datetime(3) NULL COMMENT `delete time in millisecond`, PRIMARY KEY (`id`), INDEX `idx_connector_id_user_id_template_id` (`connector_id`, `user_id`, `template_id`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_static_conversation_draft` (`id` bigint unsigned NOT NULL COMMENT 'id', `template_id` bigint unsigned NOT NULL COMMENT 'template id', `user_id` bigint unsigned NOT NULL COMMENT 'user id', `connector_id` bigint unsigned NOT NULL COMMENT 'connector id', `conversation_id` bigint unsigned NOT NULL COMMENT 'conversation id', `created_at` bigint unsigned NOT NULL COMMENT 'create time in millisecond', `deleted_at` datetime(3) NULL COMMENT 'delete time in millisecond', PRIMARY KEY (`id`), INDEX `idx_connector_id_user_id_template_id` (`connector_id`, `user_id`, `template_id`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
-- Create 'app_static_conversation_online' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_static_conversation_online` (`id` bigint unsigned NOT NULL COMMENT `id`, `template_id` bigint unsigned NOT NULL COMMENT `template id`, `user_id` bigint unsigned NOT NULL COMMENT `user id`, `connector_id` bigint unsigned NOT NULL COMMENT `connector id`, `conversation_id` bigint unsigned NOT NULL COMMENT `conversation id`, `created_at` bigint unsigned NOT NULL COMMENT `create time in millisecond`, PRIMARY KEY (`id`), INDEX `idx_connector_id_user_id_template_id` (`connector_id`, `user_id`, `template_id`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `app_static_conversation_online` (`id` bigint unsigned NOT NULL COMMENT 'id', `template_id` bigint unsigned NOT NULL COMMENT 'template id', `user_id` bigint unsigned NOT NULL COMMENT 'user id', `connector_id` bigint unsigned NOT NULL COMMENT 'connector id', `conversation_id` bigint unsigned NOT NULL COMMENT 'conversation id', `created_at` bigint unsigned NOT NULL COMMENT 'create time in millisecond', PRIMARY KEY (`id`), INDEX `idx_connector_id_user_id_template_id` (`connector_id`, `user_id`, `template_id`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
-- Create 'chat_flow_role_config' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `chat_flow_role_config` ( `id` bigint unsigned NOT NULL COMMENT `id`, `workflow_id` bigint unsigned NOT NULL COMMENT `workflow id`, `connector_id` bigint unsigned NULL COMMENT `connector id`, `name` varchar(256) NOT NULL COMMENT `role name`, `description` mediumtext NOT NULL COMMENT `role description`, `version` varchar(256) NOT NULL COMMENT `version`, `avatar` varchar(256) NOT NULL COMMENT `avatar uri`, `background_image_info` mediumtext NOT NULL COMMENT `background image information, object structure`, `onboarding_info` mediumtext NOT NULL COMMENT `intro information, object structure`, `suggest_reply_info` mediumtext NOT NULL COMMENT `user suggestions, object structure`, `audio_config` mediumtext NOT NULL COMMENT `agent audio config, object structure`, `user_input_config` varchar(256) NOT NULL COMMENT `user input config, object structure`, `creator_id` bigint unsigned NOT NULL COMMENT `creator id`, `created_at` bigint unsigned NOT NULL COMMENT `create time in millisecond`, `updated_at` bigint unsigned NULL COMMENT `update time in millisecond`, `deleted_at` datetime(3) NULL COMMENT `delete time in millisecond`, PRIMARY KEY (`id`), INDEX `idx_connector_id_version` (`connector_id`, `version`), INDEX `idx_workflow_id_version` (`workflow_id`, `version`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `chat_flow_role_config` ( `id` bigint unsigned NOT NULL COMMENT 'id', `workflow_id` bigint unsigned NOT NULL COMMENT 'workflow id', `connector_id` bigint unsigned NULL COMMENT 'connector id', `name` varchar(256) NOT NULL COMMENT 'role name', `description` mediumtext NOT NULL COMMENT 'role description', `version` varchar(256) NOT NULL COMMENT 'version', `avatar` varchar(256) NOT NULL COMMENT 'avatar uri', `background_image_info` mediumtext NOT NULL COMMENT 'background image information, object structure', `onboarding_info` mediumtext NOT NULL COMMENT 'intro information, object structure', `suggest_reply_info` mediumtext NOT NULL COMMENT 'user suggestions, object structure', `audio_config` mediumtext NOT NULL COMMENT 'agent audio config, object structure', `user_input_config` varchar(256) NOT NULL COMMENT 'user input config, object structure', `creator_id` bigint unsigned NOT NULL COMMENT 'creator id', `created_at` bigint unsigned NOT NULL COMMENT 'create time in millisecond', `updated_at` bigint unsigned NULL COMMENT 'update time in millisecond', `deleted_at` datetime(3) NULL COMMENT 'delete time in millisecond', PRIMARY KEY (`id`), INDEX `idx_connector_id_version` (`connector_id`, `version`), INDEX `idx_workflow_id_version` (`workflow_id`, `version`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
-- Create 'connector_workflow_version' table
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `connector_workflow_version` (`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `app_id` bigint unsigned NOT NULL COMMENT 'app id', `connector_id` bigint unsigned NOT NULL COMMENT 'connector id', `workflow_id` bigint unsigned NOT NULL COMMENT 'workflow id', `version` varchar(256) NOT NULL COMMENT 'version', `created_at` bigint unsigned NOT NULL COMMENT 'create time in millisecond', PRIMARY KEY (`id`), INDEX `idx_connector_id_workflow_id_create_at` (`connector_id`, `workflow_id`, `created_at`), UNIQUE INDEX `uniq_connector_id_workflow_id_version` (`connector_id`, `workflow_id`, `version`)) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'connector workflow version';
|
|
|
|
|
-- Create 'conversation' table
|
|
|
|
|
|