You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the upgrade to 4.5.1 all monitor fields get altered with NOT NULL constraint even though both null=True and blank=True are present and the model was not changed.
Expected that either no change/migrations are generated or NOT NULL doesn't get added.
Environment
Django Model Utils version: both 4.5.1 and 5.0,0
Django version: 5.1
Python version: 3.11
Other libraries used, if any: -
Code examples
models.py
...
# the field spec wasn't changed updating to the current versiontac_accepted_at=MonitorField(
monitor="state",
when=["tac_accepted"],
null=True,
default=None,
blank=True,
)
...
field alter added to the next migration after the update:
the migration fails with: django.db.utils.IntegrityError: NOT NULL constraint failed: new__application.tac_accepted_at
anage.py sqlmigrate ...
sqlmigrated produced SQL with NOT NULL constraint and fails to copy the data from the table.
The available workaround is to comment or delete the field alterations from the migrations.
The text was updated successfully, but these errors were encountered:
nad2000
changed the title
After update to 4.5.1 all monitor fields get altered with NOT NULL constraint
After update to 4.5.1/5.0.0 all monitor fields get altered with NOT NULL constraint
Sep 13, 2024
Problem
After the upgrade to 4.5.1 all monitor fields get altered with NOT NULL constraint even though both null=True and blank=True are present and the model was not changed.
Expected that either no change/migrations are generated or NOT NULL doesn't get added.
Environment
Code examples
models.py
field alter added to the next migration after the update:
the migration fails with:
django.db.utils.IntegrityError: NOT NULL constraint failed: new__application.tac_accepted_at
anage.py sqlmigrate ...
sqlmigrated produced SQL with NOT NULL constraint and fails to copy the data from the table.
The available workaround is to comment or delete the field alterations from the migrations.
The text was updated successfully, but these errors were encountered: