From e5db24ff1ce0f7a476cb17500a0b1767b0bf0aa7 Mon Sep 17 00:00:00 2001 From: junwen-lee Date: Fri, 29 Aug 2025 17:00:28 +0800 Subject: [PATCH] fix(ci): ddl apply (#1873) --- docker/docker-compose-debug.yml | 6 +++--- docker/docker-compose.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/docker-compose-debug.yml b/docker/docker-compose-debug.yml index 32004a06..73d92aae 100755 --- a/docker/docker-compose-debug.yml +++ b/docker/docker-compose-debug.yml @@ -19,7 +19,7 @@ services: volumes: - ./data/mysql:/var/lib/mysql - ./volumes/mysql/schema.sql:/docker-entrypoint-initdb.d/init.sql - - ./atlas/migrations:/atlas-migrations:ro + - ./atlas/opencoze_latest_schema.hcl:/opencoze_latest_schema.hcl:ro entrypoint: - bash - -c @@ -54,10 +54,10 @@ services: echo 'Atlas CLI already installed' fi - if [ -d '/atlas-migrations' ] && [ "$$(ls -A /atlas-migrations)" ]; then + if [ -f '/opencoze_latest_schema.hcl' ]; 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 + atlas schema apply -u "$ATLAS_URL" --to "file:///opencoze_latest_schema.hcl" --exclude "atlas_schema_revisions,table_*" --auto-approve echo 'Atlas migrations completed successfully' else echo 'No migrations found' diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 901b5589..9ce27523 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -53,10 +53,10 @@ services: echo 'Atlas CLI already installed' fi - if [ -d '/atlas-migrations' ] && [ "$$(ls -A /atlas-migrations)" ]; then + if [ -f '/opencoze_latest_schema.hcl' ]; then echo 'Running Atlas migrations...' ATLAS_URL="mysql://$${MYSQL_USER}:$${MYSQL_PASSWORD}@localhost:3306/$${MYSQL_DATABASE}" - atlas schema apply -u "$ATLAS_URL" --to "file:///opencoze_latest_schema.hcl" --auto-approve + atlas schema apply -u "$ATLAS_URL" --to "file:///opencoze_latest_schema.hcl" --exclude "atlas_schema_revisions,table_*" --auto-approve echo 'Atlas migrations completed successfully' else echo 'No migrations found'