Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration failed, keyerror, migrator.orm is empty #32

Open
brnosouza opened this issue Jul 5, 2021 · 2 comments
Open

Migration failed, keyerror, migrator.orm is empty #32

brnosouza opened this issue Jul 5, 2021 · 2 comments

Comments

@brnosouza
Copy link

I'm trying to create my first migration, however, the sorting mechanism is not ordering correctly the table's creation raising KeyError, I think the error lies on peewee_migrate/auto.py:133, the function sort_models from peewee is not ordering correctly.

traceback:

root@c5f155f1ac41:/app$ pw_migrate migrate
Starting migrations
Migrate "001_auto_20210705_1356"
Migration failed: 001_auto_20210705_1356
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/peewee_migrate/router.py", line 157, in run_one
    migrate(migrator, self.database, fake=fake)
  File "<string>", line 166, in migrate
  File "<string>", line 183, in ClientTelephone
KeyError: 'telephone_types'
Traceback (most recent call last):
  File "/usr/local/bin/pw_migrate", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/peewee_migrate/cli.py", line 107, in migrate
    migrations = router.run(name, fake=fake)
  File "/usr/local/lib/python3.9/site-packages/peewee_migrate/router.py", line 186, in run
    self.run_one(mname, migrator, fake=fake, force=fake)
  File "/usr/local/lib/python3.9/site-packages/peewee_migrate/router.py", line 157, in run_one
    migrate(migrator, self.database, fake=fake)
  File "<string>", line 166, in migrate
  File "<string>", line 183, in ClientTelephone
KeyError: 'telephone_types'
@brnosouza
Copy link
Author

The original package has the same issue: klen#163

@spumer
Copy link
Owner

spumer commented Jul 5, 2021

Can you post your models which trigger this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants