Greetings, This problem has been bugging our dev team for quite a long time. When we try to use Docker and migrate the db, we always get the error:
load config /app/conf/config.json
CMD yoyo apply --database=mysql://db:password@user:3306/db /app/migrations
Traceback (most recent call last):
File "/usr/local/bin/yoyo", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/yoyo/scripts/main.py", line 313, in main
args.func(args, config)
File "/usr/local/lib/python3.9/site-packages/yoyo/scripts/migrate.py", line 274, in apply
migrations = get_migrations(args, backend)
File "/usr/local/lib/python3.9/site-packages/yoyo/scripts/migrate.py", line 229, in get_migrations
migrations = backend.to_apply(migrations)
File "/usr/local/lib/python3.9/site-packages/yoyo/backends.py", line 430, in to_apply
applied = self.get_applied_migration_hashes()
File "/usr/local/lib/python3.9/site-packages/yoyo/backends.py", line 422, in get_applied_migration_hashes
self.ensure_internal_schema_updated()
File "/usr/local/lib/python3.9/site-packages/yoyo/backends.py", line 407, in ensure_internal_schema_updated
if internalmigrations.needs_upgrading(self):
File "/usr/local/lib/python3.9/site-packages/yoyo/internalmigrations/__init__.py", line 20, in needs_upgrading
return get_current_version(backend) < max(schema_versions)
File "/usr/local/lib/python3.9/site-packages/yoyo/internalmigrations/__init__.py", line 58, in get_current_version
assert version in schema_versions
AssertionError
migrate ERROR 256
When running the app outside of Docker, the migration works fine. We are currently using MySQL 8.
The method used is basically:
docker-compose up -d db # Up the db
docker-compose exec backend bash -l -c 'python3 /app/scripts/db_migrate.py' # Run the migrations
The migration script itself is just a fancy way of building the yoyo apply command, running yoyo apply by hand into the container will get the same result. So far we are using the latest release at that time which is the 7.3.2.
Anyone would have an idea? Thanks
// Jae
Hi,
I experienced the same thing but turns out we deleted the entries in yoyo helper tables and this created this issue, dropping yoyo helper tables and marking the ones already applied as run solved the issue. No issue in the package itself IMO.