klen / peewee_migrate

Simple migration engine for Peewee

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL OperationalError due to missing quotation marks around default values

stlehmann opened this issue · comments

Error description

When using pw_migrate with the --auto flag to add a new CharField with a default value to a table it produces code like this:

@migrator.create_model
class Color(pw.Model):
    id = pw.AutoField()
    name = pw.CharField(constraints=[SQL("DEFAULT New Color")], max_length=255)

The last line will lead to an Operational error because there are quotation marks missing around the default values.

System configuration

  • Operarating System: Windows 10
  • Python Version: Python 3.7.0 64bit
  • Peewee Version: 3.6.4
  • peewee_migrate: develop branch
  • database engine: sqlite