klen / peewee_migrate

Simple migration engine for Peewee
MIT License
353 stars 86 forks source link

Every fields with default value are considered changed. #144

Open trim21 opened 5 years ago

trim21 commented 5 years ago

I'm not quite sure that is my mistake or its a bug of peewee_migrate.

image

left is my first migration, and i didn't change followed table, but edited another table. Then I generated a migration.

But i found that pw.CharField and pw.InteferField are both consider changed. Seems that all field with default value are considered changed and automatically get a migration.

trim21 commented 5 years ago

Found workaround. Manually replace onstraints=[SQL("DEFAULT 0")] with default=0, and the migrate will work as excpted.

zhjchina commented 5 years ago

I'm not quite sure that is my mistake or its a bug of peewee_migrate.

image

left is my first migration, and i didn't change followed table, but edited another table. Then I generated a migration.

But i found that pw.CharField and pw.InteferField are both consider changed. Seems that all field with default value are considered changed and automatically get a migration.

I encounter the same problem。It is a bug,the default value show not generate "constraints" param,but generate "default" param

trim21 commented 5 years ago

@zhjchina I try pwiz in peewee package, it has same behavior.