Skip to content

Incorrect index drop/remove syntax #230

@dmwyatt

Description

@dmwyatt

I'm getting auto-generated migrations with lines like this:

migrator.drop_index('schoolsport', 'school', 'sport')

migrator.add_index('schoolsport', <Model: School>, 'sport', unique=True)

Note the <Model: School>...the default repr generated by peewee. It's not even wrapped in quotes, it's just this text making these migration files invalid python.

Because this only started happening after I refactored my models into multiple modules in a package rather than all in one module, I'm guessing it's somehow related to model discovery? The other thing is, is that there's no reason for it to be dropping these indexes...I haven't changed them.

I don't mind working on a PR if anyone can give me some pointers to where the likely culprit of this is. I don't have time at this very moment to work on a repro, but I will soon if no one has an idea of what's going on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions