feat: Support for Chat Flow & Agent Support for binding a single chat flow (#765)

Co-authored-by: Yu Yang <72337138+tomasyu985@users.noreply.github.com>
Co-authored-by: zengxiaohui <csu.zengxiaohui@gmail.com>
Co-authored-by: lijunwen.gigoo <lijunwen.gigoo@bytedance.com>
Co-authored-by: lvxinyu.1117 <lvxinyu.1117@bytedance.com>
Co-authored-by: liuyunchao.0510 <liuyunchao.0510@bytedance.com>
Co-authored-by: haozhenfei <37089575+haozhenfei@users.noreply.github.com>
Co-authored-by: July <jiangxujin@bytedance.com>
Co-authored-by: tecvan-fe <fanwenjie.fe@bytedance.com>
This commit is contained in:
Zhj
2025-08-28 21:53:32 +08:00
committed by GitHub
parent bbc615a18e
commit d70101c979
503 changed files with 48036 additions and 3427 deletions

View File

@ -0,0 +1,100 @@
-- Create "app_conversation_template_draft" table
CREATE TABLE `opencoze`.`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`)
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Create "app_conversation_template_online" table
CREATE TABLE `opencoze`.`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`)
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Create "app_dynamic_conversation_draft" table
CREATE TABLE `opencoze`.`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`)
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Create "app_dynamic_conversation_online" table
CREATE TABLE `opencoze`.`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`)
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Create "app_static_conversation_draft" table
CREATE TABLE `opencoze`.`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`)
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Create "app_static_conversation_online" table
CREATE TABLE `opencoze`.`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`)
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Create "chat_flow_role_config" table
CREATE TABLE `opencoze`.`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`)
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;

View File

@ -0,0 +1,2 @@
-- Create "files" table
CREATE TABLE `opencoze`.`files` (`id` bigint unsigned NOT NULL COMMENT "id", `name` varchar(255) NOT NULL DEFAULT "" COMMENT "file name", `file_size` bigint unsigned NOT NULL DEFAULT 0 COMMENT "file size", `tos_uri` varchar(1024) NOT NULL DEFAULT "" COMMENT "TOS URI", `status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "status0invalid1valid", `comment` varchar(1024) NOT NULL DEFAULT "" COMMENT "file comment", `source` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "source1 from API,", `creator_id` varchar(512) NOT NULL DEFAULT "" COMMENT "creator id", `content_type` varchar(255) NOT NULL DEFAULT "" COMMENT "content type", `coze_account_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "coze account id", `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(3) NULL COMMENT "Delete Time", PRIMARY KEY (`id`), INDEX `idx_creator_id` (`creator_id`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "file resource table";

View File

@ -0,0 +1,7 @@
-- Modify "api_key" table
ALTER TABLE `opencoze`.`api_key` ADD COLUMN `ak_type` tinyint NOT NULL DEFAULT 0 COMMENT "api key type ";
-- Modify "single_agent_draft" table
ALTER TABLE `opencoze`.`single_agent_draft` ADD COLUMN `bot_mode` tinyint NOT NULL DEFAULT 0 COMMENT "bot mode,0:single mode 2:chatflow mode" AFTER `database_config`, ADD COLUMN `layout_info` text NULL COMMENT "chatflow layout info";
-- Modify "single_agent_version" table
ALTER TABLE `opencoze`.`single_agent_version` ADD COLUMN `bot_mode` tinyint NOT NULL DEFAULT 0 COMMENT "bot mode,0:single mode 2:chatflow mode" AFTER `database_config`, ADD COLUMN `layout_info` text NULL COMMENT "chatflow layout info";

View File

@ -0,0 +1,2 @@
-- Modify "conversation" table
ALTER TABLE `opencoze`.`conversation` ADD COLUMN `name` varchar(255) NOT NULL DEFAULT "" COMMENT "conversation name" AFTER `id`;

View File

@ -1,4 +1,4 @@
h1:3ar6fnSw3e4ni74BcE2N9cIentO27OcfSt465WTv2Po=
h1:pZ9P9pFFqnfVc+o3V1CJLD8Rv3WyFM+mSwqKk1GTRRs=
20250703095335_initial.sql h1:/joaeUTMhXqAEc0KwsSve5+bYM0qPOp+9OizJtsRc+U=
20250703115304_update.sql h1:cbYo6Q6Lh96hB4hu5KW2Nn/Mr0VDpg7a1WPgpIb1SOc=
20250704040445_update.sql h1:QWmoPY//oQ+GFZwET9w/oAWa8mM0KVaD5G8Yiu9bMqY=
@ -6,5 +6,9 @@ h1:3ar6fnSw3e4ni74BcE2N9cIentO27OcfSt465WTv2Po=
20250710100212_update.sql h1:mN/3iKQDoIw2BTkMwWp3I/qOAcVGrQJ5tOJ0OqH4ZWU=
20250711034533_update.sql h1:EWeK//5urS9hJIRCeD3lwQYWNH9AIKEWG9pMLdw7KPc=
20250717125913_update.sql h1:WtPR99RlWZn0rXZsB19qp1hq0FwO5qmFhcTcV6EnFYs=
20250730131847_update.sql h1:qIutMrXtuOA98jeucTFxXck+sQNjNTtIF2apbCYt3IY=
20250802115105_update.sql h1:irreQaMAL0LtXcDlkdHP86C7/0e2HzEVsa1hP/FkZ2M=
20250718104121_update.sql h1:JY7wbfjkmqTUAvTKBm9mC1w/cobKfSGK3eqYBUpDF0k=
20250730131847_update.sql h1:3bSBm4UxtXWKSmnQHcd/T9uqw6riB0vcFNatiR6Ptj8=
20250802115105_update.sql h1:89M8rwxbidK8uZ0UDFS++HQw+m/b0vugbfrF6kQXbEI=
20250812093734_update.sql h1:27fQaPt0LYi1dA7MABvERthVR4pj4MRWFgdRVR3cd6w=
20250813081543_update.sql h1:HyBPu1LVs8oiyABbZDU3fFW0n6MeC7qOpzcHWVkwNVc=
20250822060516_update.sql h1:KoL8FPXw5/JMsJMtJsoGFIc4wYHlngBudeYSz5o4iKU=

View File

@ -275,6 +275,12 @@ table "api_key" {
default = 0
comment = "Used Time in Milliseconds"
}
column "ak_type" {
null = false
type = tinyint
default = 0
comment = "api key type "
}
primary_key {
columns = [column.id]
}
@ -335,6 +341,122 @@ table "app_connector_release_ref" {
columns = [column.record_id, column.connector_id]
}
}
table "app_conversation_template_draft" {
schema = schema.opencoze
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
}
column "app_id" {
null = false
type = bigint
unsigned = true
comment = "app id"
}
column "space_id" {
null = false
type = bigint
unsigned = true
comment = "space id"
}
column "name" {
null = false
type = varchar(256)
comment = "conversation name"
}
column "template_id" {
null = false
type = bigint
unsigned = true
comment = "template id"
}
column "creator_id" {
null = false
type = bigint
unsigned = true
comment = "creator id"
}
column "created_at" {
null = false
type = bigint
unsigned = true
comment = "create time in millisecond"
}
column "updated_at" {
null = true
type = bigint
unsigned = true
comment = "update time in millisecond"
}
column "deleted_at" {
null = true
type = datetime(3)
comment = "delete time in millisecond"
}
primary_key {
columns = [column.id]
}
index "idx_space_id_app_id_template_id" {
columns = [column.space_id, column.app_id, column.template_id]
}
}
table "app_conversation_template_online" {
schema = schema.opencoze
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
}
column "app_id" {
null = false
type = bigint
unsigned = true
comment = "app id"
}
column "space_id" {
null = false
type = bigint
unsigned = true
comment = "space id"
}
column "name" {
null = false
type = varchar(256)
comment = "conversation name"
}
column "template_id" {
null = false
type = bigint
unsigned = true
comment = "template id"
}
column "version" {
null = false
type = varchar(256)
comment = "version name"
}
column "creator_id" {
null = false
type = bigint
unsigned = true
comment = "creator id"
}
column "created_at" {
null = false
type = bigint
unsigned = true
comment = "create time in millisecond"
}
primary_key {
columns = [column.id]
}
index "idx_space_id_app_id_template_id_version" {
columns = [column.space_id, column.app_id, column.template_id, column.version]
}
}
table "app_draft" {
schema = schema.opencoze
comment = "Draft Application"
@ -399,6 +521,122 @@ table "app_draft" {
columns = [column.id]
}
}
table "app_dynamic_conversation_draft" {
schema = schema.opencoze
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
}
column "app_id" {
null = false
type = bigint
unsigned = true
comment = "app id"
}
column "name" {
null = false
type = varchar(256)
comment = "conversation name"
}
column "user_id" {
null = false
type = bigint
unsigned = true
comment = "user id"
}
column "connector_id" {
null = false
type = bigint
unsigned = true
comment = "connector id"
}
column "conversation_id" {
null = false
type = bigint
unsigned = true
comment = "conversation id"
}
column "created_at" {
null = false
type = bigint
unsigned = true
comment = "create time in millisecond"
}
column "deleted_at" {
null = true
type = datetime(3)
comment = "delete time in millisecond"
}
primary_key {
columns = [column.id]
}
index "idx_app_id_connector_id_user_id" {
columns = [column.app_id, column.connector_id, column.user_id]
}
index "idx_connector_id_user_id_name" {
columns = [column.connector_id, column.user_id, column.name]
}
}
table "app_dynamic_conversation_online" {
schema = schema.opencoze
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
}
column "app_id" {
null = false
type = bigint
unsigned = true
comment = "app id"
}
column "name" {
null = false
type = varchar(256)
comment = "conversation name"
}
column "user_id" {
null = false
type = bigint
unsigned = true
comment = "user id"
}
column "connector_id" {
null = false
type = bigint
unsigned = true
comment = "connector id"
}
column "conversation_id" {
null = false
type = bigint
unsigned = true
comment = "conversation id"
}
column "created_at" {
null = false
type = bigint
unsigned = true
comment = "create time in millisecond"
}
column "deleted_at" {
null = true
type = datetime(3)
comment = "delete time in millisecond"
}
primary_key {
columns = [column.id]
}
index "idx_app_id_connector_id_user_id" {
columns = [column.app_id, column.connector_id, column.user_id]
}
index "idx_connector_id_user_id_name" {
columns = [column.connector_id, column.user_id, column.name]
}
}
table "app_release_record" {
schema = schema.opencoze
comment = "Application Release Record"
@ -506,6 +744,199 @@ table "app_release_record" {
columns = [column.app_id, column.version]
}
}
table "app_static_conversation_draft" {
schema = schema.opencoze
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
}
column "template_id" {
null = false
type = bigint
unsigned = true
comment = "template id"
}
column "user_id" {
null = false
type = bigint
unsigned = true
comment = "user id"
}
column "connector_id" {
null = false
type = bigint
unsigned = true
comment = "connector id"
}
column "conversation_id" {
null = false
type = bigint
unsigned = true
comment = "conversation id"
}
column "created_at" {
null = false
type = bigint
unsigned = true
comment = "create time in millisecond"
}
column "deleted_at" {
null = true
type = datetime(3)
comment = "delete time in millisecond"
}
primary_key {
columns = [column.id]
}
index "idx_connector_id_user_id_template_id" {
columns = [column.connector_id, column.user_id, column.template_id]
}
}
table "app_static_conversation_online" {
schema = schema.opencoze
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
}
column "template_id" {
null = false
type = bigint
unsigned = true
comment = "template id"
}
column "user_id" {
null = false
type = bigint
unsigned = true
comment = "user id"
}
column "connector_id" {
null = false
type = bigint
unsigned = true
comment = "connector id"
}
column "conversation_id" {
null = false
type = bigint
unsigned = true
comment = "conversation id"
}
column "created_at" {
null = false
type = bigint
unsigned = true
comment = "create time in millisecond"
}
primary_key {
columns = [column.id]
}
index "idx_connector_id_user_id_template_id" {
columns = [column.connector_id, column.user_id, column.template_id]
}
}
table "chat_flow_role_config" {
schema = schema.opencoze
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
}
column "workflow_id" {
null = false
type = bigint
unsigned = true
comment = "workflow id"
}
column "connector_id" {
null = true
type = bigint
unsigned = true
comment = "connector id"
}
column "name" {
null = false
type = varchar(256)
comment = "role name"
}
column "description" {
null = false
type = mediumtext
comment = "role description"
}
column "version" {
null = false
type = varchar(256)
comment = "version"
}
column "avatar" {
null = false
type = varchar(256)
comment = "avatar uri"
}
column "background_image_info" {
null = false
type = mediumtext
comment = "background image information, object structure"
}
column "onboarding_info" {
null = false
type = mediumtext
comment = "intro information, object structure"
}
column "suggest_reply_info" {
null = false
type = mediumtext
comment = "user suggestions, object structure"
}
column "audio_config" {
null = false
type = mediumtext
comment = "agent audio config, object structure"
}
column "user_input_config" {
null = false
type = varchar(256)
comment = "user input config, object structure"
}
column "creator_id" {
null = false
type = bigint
unsigned = true
comment = "creator id"
}
column "created_at" {
null = false
type = bigint
unsigned = true
comment = "create time in millisecond"
}
column "updated_at" {
null = true
type = bigint
unsigned = true
comment = "update time in millisecond"
}
column "deleted_at" {
null = true
type = datetime(3)
comment = "delete time in millisecond"
}
primary_key {
columns = [column.id]
}
index "idx_connector_id_version" {
columns = [column.connector_id, column.version]
}
index "idx_workflow_id_version" {
columns = [column.workflow_id, column.version]
}
}
table "connector_workflow_version" {
schema = schema.opencoze
comment = "connector workflow version"
@ -566,6 +997,12 @@ table "conversation" {
comment = "id"
auto_increment = true
}
column "name" {
null = true
type = varchar(255)
default = ""
comment = "conversation name"
}
column "connector_id" {
null = false
type = bigint
@ -850,6 +1287,100 @@ table "draft_database_info" {
columns = [column.space_id, column.app_id, column.creator_id, column.deleted_at]
}
}
table "files" {
schema = schema.opencoze
comment = "file resource table"
collate = "utf8mb4_general_ci"
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
}
column "name" {
null = false
type = varchar(255)
default = ""
comment = "file name"
}
column "file_size" {
null = false
type = bigint
default = 0
unsigned = true
comment = "file size"
}
column "tos_uri" {
null = false
type = varchar(1024)
default = ""
comment = "TOS URI"
}
column "status" {
null = false
type = tinyint
default = 0
unsigned = true
comment = "status0invalid1valid"
}
column "comment" {
null = false
type = varchar(1024)
default = ""
comment = "file comment"
}
column "source" {
null = false
type = tinyint
default = 0
unsigned = true
comment = "source1 from API,"
}
column "creator_id" {
null = false
type = varchar(512)
default = ""
comment = "creator id"
}
column "content_type" {
null = false
type = varchar(255)
default = ""
comment = "content type"
}
column "coze_account_id" {
null = false
type = bigint
default = 0
unsigned = true
comment = "coze account id"
}
column "created_at" {
null = false
type = bigint
default = 0
unsigned = true
comment = "Create Time in Milliseconds"
}
column "updated_at" {
null = false
type = bigint
default = 0
unsigned = true
comment = "Update Time in Milliseconds"
}
column "deleted_at" {
null = true
type = datetime(3)
comment = "Delete Time"
}
primary_key {
columns = [column.id]
}
index "idx_creator_id" {
columns = [column.creator_id]
}
}
table "knowledge" {
schema = schema.opencoze
comment = "knowledge tabke"
@ -2608,6 +3139,17 @@ table "single_agent_draft" {
type = json
comment = "Agent Database Base Configuration"
}
column "bot_mode" {
null = false
type = tinyint
default = 0
comment = "bot mode,0:single mode 2:chatflow mode"
}
column "layout_info" {
null = true
type = text
comment = "chatflow layout info"
}
column "shortcut_command" {
null = true
type = json
@ -2769,6 +3311,17 @@ table "single_agent_version" {
unsigned = true
comment = "Create Time in Milliseconds"
}
column "bot_mode" {
null = false
type = tinyint
default = 0
comment = "bot mode,0:single mode 2:chatflow mode"
}
column "layout_info" {
null = true
type = text
comment = "chatflow layout info"
}
column "updated_at" {
null = false
type = bigint

View File

@ -18,9 +18,52 @@ services:
- '3306:3306'
volumes:
- ./data/mysql:/var/lib/mysql
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- ./volumes/mysql/schema.sql:/docker-entrypoint-initdb.d/init.sql
- ./atlas/migrations:/atlas-migrations:ro
entrypoint:
- bash
- -c
- |
/usr/local/bin/docker-entrypoint.sh mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci &
MYSQL_PID=$$!
echo 'Waiting for MySQL to start...'
until mysqladmin ping -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} --silent 2>/dev/null; do
echo 'MySQL is starting...'
sleep 2
done
echo 'Waiting for workflow_version table to exist...'
while true; do
if mysql -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} $${MYSQL_DATABASE} -e "SHOW TABLES LIKE 'workflow_version';" 2>/dev/null | grep -q "workflow_version"; then
echo 'Found workflow_version table, continuing...'
break
else
echo 'workflow_version table not found, retrying in 2 seconds...'
sleep 2
fi
done
echo 'MySQL is ready, installing Atlas CLI...'
if ! command -v atlas >/dev/null 2>&1; then
echo 'Installing Atlas CLI...'
curl -sSf https://atlasgo.sh | sh -s -- -y --community
export PATH=$$PATH:/root/.local/bin
else
echo 'Atlas CLI already installed'
fi
if [ -d '/atlas-migrations' ] && [ "$$(ls -A /atlas-migrations)" ]; then
echo 'Running Atlas migrations...'
ATLAS_URL="mysql://$${MYSQL_USER}:$${MYSQL_PASSWORD}@localhost:3306/$${MYSQL_DATABASE}"
atlas migrate apply --url "$$ATLAS_URL" --dir "file:///atlas-migrations" --allow-dirty
echo 'Atlas migrations completed successfully'
else
echo 'No migrations found'
fi
wait $$MYSQL_PID
healthcheck:
test:
[

View File

@ -18,9 +18,50 @@ services:
volumes:
- ./data/mysql:/var/lib/mysql
- ./volumes/mysql/schema.sql:/docker-entrypoint-initdb.d/init.sql
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- ./atlas/migrations:/atlas-migrations:ro
entrypoint:
- bash
- -c
- |
/usr/local/bin/docker-entrypoint.sh mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci &
MYSQL_PID=$$!
echo 'Waiting for MySQL to start...'
until mysqladmin ping -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} --silent 2>/dev/null; do
echo 'MySQL is starting...'
sleep 2
done
echo 'Waiting for workflow_version table to exist...'
while true; do
if mysql -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} $${MYSQL_DATABASE} -e "SHOW TABLES LIKE 'workflow_version';" 2>/dev/null | grep -q "workflow_version"; then
echo 'Found workflow_version table, continuing...'
break
else
echo 'workflow_version table not found, retrying in 2 seconds...'
sleep 2
fi
done
echo 'MySQL is ready, installing Atlas CLI...'
if ! command -v atlas >/dev/null 2>&1; then
echo 'Installing Atlas CLI...'
curl -sSf https://atlasgo.sh | sh -s -- -y --community
export PATH=$$PATH:/root/.local/bin
else
echo 'Atlas CLI already installed'
fi
if [ -d '/atlas-migrations' ] && [ "$$(ls -A /atlas-migrations)" ]; then
echo 'Running Atlas migrations...'
ATLAS_URL="mysql://$${MYSQL_USER}:$${MYSQL_PASSWORD}@localhost:3306/$${MYSQL_DATABASE}"
atlas migrate apply --url "$$ATLAS_URL" --dir "file:///atlas-migrations" --allow-dirty
echo 'Atlas migrations completed successfully'
else
echo 'No migrations found'
fi
wait $$MYSQL_PID
healthcheck:
test:
[

File diff suppressed because it is too large Load Diff