Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration 0004 blows up with Django 4 (NullBooleanField?) #411

Open
hugorodgerbrown opened this issue Oct 6, 2021 · 3 comments
Open

Migration 0004 blows up with Django 4 (NullBooleanField?) #411

hugorodgerbrown opened this issue Oct 6, 2021 · 3 comments

Comments

@hugorodgerbrown
Copy link
Contributor

hugorodgerbrown commented Oct 6, 2021

If you run the test suite against Django 4.0a1, it'll fail on setup with the following message:

ValueError: Cannot alter field waffle.Flag.everyone into waffle.Flag.everyone - 
they do not properly define db_type (are you using a badly-written custom field?)

The migration that fails is 0004_update_everyone_nullbooleanfield, which, rather embarrassingly, was added by me when Django dropped the NullBooleanField. (See commit 4e365fe).

It looks like the problem is caused by going from a NullBooleanField (no longer supported) to a BooleanField - which occurs in migration 0004. This situation would not occur in a mature codebase, where this migration has already been applied, however it does appear in test runs where the database is being set up, and will occur for anyone who adds django-waffle if to a Django 4+ project.

I believe the solution is to retrospectively edit the existing migrations to remove the NullBooleanField references. I'll submit a PR just to check it passes CI.

@mrxsal
Copy link

mrxsal commented May 9, 2023

I am on Django==1.11.29, and when installing django-waffle, I now get the following error:

waffle.Flag.everyone: (fields.E110) BooleanFields do not accept null values.
        HINT: Use a NullBooleanField instead.

Could it be related to this change?

@clintonb
Copy link
Collaborator

clintonb commented May 9, 2023

@mrxsal Django 1.x has not been supported for quite some time. We cannot help you with those errors. You’ll need to either upgrade Django, or use an older version of Django-Waffle.

@mrxsal
Copy link

mrxsal commented May 10, 2023

Thanks. django-waffle==1.0.0 works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants