Use pw.SQL instead of SQL in migration files
mekanix opened this issue · comments
Given the following simple model, generated migration has a typo:
class User(BaseModel):
active = BooleanField(default=True)
Migration I get (the relevant part):
@migrator.create_model
class User(pw.Model):
id = pw.AutoField()
active = pw.BooleanField(constraints=[SQL("DEFAULT True")])
This fails, but replacing SQL with pw.SQL works like a charm. I can't find the code which generates it, so if you help me debug this issue, I'll be happy to send PR.
I forgot to mention, https://github.com/mekanix/peewee_migrate/commit/912132a6cee28d18320c07de4a148f0751218661 is what I use as a workaround currently
Hello, I have faced the same question too. I wonder if there is a normal way to solve the problem. Now I use the same way like you to deal with it but I hope a better solution.