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

rename_field doesn't work #99

Open
cvitan opened this issue Aug 24, 2018 · 0 comments
Open

rename_field doesn't work #99

cvitan opened this issue Aug 24, 2018 · 0 comments

Comments

@cvitan
Copy link

cvitan commented Aug 24, 2018

The rename_field method fails with a KeyError on trying to get the old field from model._meta_fields, i.e. field = model._meta.fields[old_name]. As far as I can see, this will always fail since the model field has been renamed already and the old field name key is gone, or am I missing something?

Version: 1.0.0

Steps to reproduce:

  1. rename the field of a model
  2. create a migration that includes migrator.rename_field(FooModel, 'old_foo', 'new_bar')
  3. run the migration

Expected: Success
Actual: the following exception:

  File "/usr/local/lib/python3.6/site-packages/peewee_migrate/migrator.py", line 260, in rename_column
    field = model._meta.fields[old_name]
KeyError: 'old_foo'
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

1 participant