fix(ci): ddl apply
This commit is contained in:
@ -19,7 +19,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./data/mysql:/var/lib/mysql
|
- ./data/mysql:/var/lib/mysql
|
||||||
- ./volumes/mysql/schema.sql:/docker-entrypoint-initdb.d/init.sql
|
- ./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:
|
entrypoint:
|
||||||
- bash
|
- bash
|
||||||
- -c
|
- -c
|
||||||
@ -54,10 +54,10 @@ services:
|
|||||||
echo 'Atlas CLI already installed'
|
echo 'Atlas CLI already installed'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d '/atlas-migrations' ] && [ "$$(ls -A /atlas-migrations)" ]; then
|
if [ -f '/opencoze_latest_schema.hcl' ]; then
|
||||||
echo 'Running Atlas migrations...'
|
echo 'Running Atlas migrations...'
|
||||||
ATLAS_URL="mysql://$${MYSQL_USER}:$${MYSQL_PASSWORD}@localhost:3306/$${MYSQL_DATABASE}"
|
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'
|
echo 'Atlas migrations completed successfully'
|
||||||
else
|
else
|
||||||
echo 'No migrations found'
|
echo 'No migrations found'
|
||||||
|
|||||||
@ -53,10 +53,10 @@ services:
|
|||||||
echo 'Atlas CLI already installed'
|
echo 'Atlas CLI already installed'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d '/atlas-migrations' ] && [ "$$(ls -A /atlas-migrations)" ]; then
|
if [ -f '/opencoze_latest_schema.hcl' ]; then
|
||||||
echo 'Running Atlas migrations...'
|
echo 'Running Atlas migrations...'
|
||||||
ATLAS_URL="mysql://$${MYSQL_USER}:$${MYSQL_PASSWORD}@localhost:3306/$${MYSQL_DATABASE}"
|
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'
|
echo 'Atlas migrations completed successfully'
|
||||||
else
|
else
|
||||||
echo 'No migrations found'
|
echo 'No migrations found'
|
||||||
|
|||||||
Reference in New Issue
Block a user