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

Swappable flag model not actually swappable? #338

Open
djsmedes opened this issue Jun 21, 2019 · 1 comment
Open

Swappable flag model not actually swappable? #338

djsmedes opened this issue Jun 21, 2019 · 1 comment

Comments

@djsmedes
Copy link

It seems that when using a custom flag model, the original model and its many-to-many tables are still created.

If I just manually go into the waffle migrations and add 'swappable': 'WAFFLE_FLAG_MODEL' into the options dict of the CreateModel(name='Flag', ... migration, then the standard flag model and its m2m tables are NOT created, as I want.

Obviously that is not how the fix should be made, because that would break existing implementations, but I don't know exactly how to properly do these sorts of migrations; hoping someone here has more expertise.

@vinkomlacic
Copy link

vinkomlacic commented Feb 10, 2025

I had the same problem where the tests were broken because flush command was trying to truncate data and auth_user table was still referencing waffle_flag_users.

I made a workaround for this by creating custom models for flags, switches, and samples in my app and completely disabling migrations for the waffle app. Of course, this is only possible if you don't really care about the existing data.

settings.py:

MIGRATION_MODULES = {
    "waffle": None,
}

But I suppose the real fix is to have a new breaking major version which has the swappable: WAFFLE_FLAG_MODEL like @djsmedes suggested.

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

2 participants