Closed dsmurrell closed 5 years ago
Ok, I seem to have found a workaround. That is to drop the null=True
first, then evolve, then add the default=""
for which the evolve doesn't seem to do anything.
This does mean that we need to migrate to prod twice being careful not to nuke data :)
well that is horrifying. sorry about that. there should definitely be a WHERE "title" IS NULL
on the UPDATE
statement.
found the issue. affects peewee3 only.
in peewee's schema migration library (which we use in places under peewee3) the migration function apply_default()
applies the default for all values, not just where they're currently null. that seems wrong, but maybe i'm not understanding the intent.
should have a patch out soon to work around.
thanks for the bug report!
peewee-db-evolve-3.7.3 released
That was fast, thank you!
And thanks for the extremely useful peewee-db-evolve!
Seconded @keredson !
I have a table 'Surveys' which has fields 'title' and 'description'.
The surveys all had existing titles and descriptions and were also
null=True
.When removing the
null=True
and replacing it withdefault=""
, evolve replaces all the existing values with""
.So for:
changing to:
evolve does:
Is this expected behaviour?
How can I get it to not replace the existing values?