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

Using django-flags with migrate_schemas #85

Open
Vinci08 opened this issue Nov 30, 2021 · 2 comments
Open

Using django-flags with migrate_schemas #85

Vinci08 opened this issue Nov 30, 2021 · 2 comments

Comments

@Vinci08
Copy link

Vinci08 commented Nov 30, 2021

Hi,
Our django app uses django-tenant-schemas, thus we need to use migrate_schemas instead of migrate. I followed your user guide except for the migrate step, and always got the error below when click flagstate in django admin panel. I have researched this issue for couple hours, but there was very little info on this. I'd like to know if django-flags support migrate_schemas? That way I can understand the source of our problem.

Thank you!

`

ProgrammingError at /admin/flags/flagstate/add/

relation "flags_flagstate" does not exist
LINE 1: ...state"."value", "flags_flagstate"."required" FROM "flags_fla...
                                                             ^
Request Method: GET
http://127.0.0.1:8000/admin/flags/flagstate/add/
2.0.5
ProgrammingError
relation "flags_flagstate" does not exist LINE 1: ...state"."value", "flags_flagstate"."required" FROM "flags_fla...
`
@willbarton
Copy link
Member

willbarton commented Nov 30, 2021

Hi @Vinci08. I'm not familiar with django-tenant-schema, so I don't know right off what it's doing that might be different from Django's standard migrate. With a glance at the documentation, it looks like migrate_schemas should call migrate. There's nothing I can see right off that suggests django-tenant-schema can't work with django-flags. The lack of the relation suggests that the django-flags models aren't getting migrated correctly however.

I wonder, where do you have the "flags" app included in the various _APPS settings that django-tenant-schema provides? My suspicion would be something to do with this — the "flags" migrations aren't getting run, and if django-tenant-schema is using these settings to determine which apps to migrate, that would suggest it needs to be included in one or more of them.

I will note too, if there are particular changes that would make django-flags work with multi-tenancy Django, we'd happily accept them!

@Vinci08
Copy link
Author

Vinci08 commented Nov 30, 2021

Hi @willbarton , thank you for taking your time and looking into this issue!

I included flags in both shared_app and installed_app, but the problem remained the same. Even though django would say flags being migrated with 00012 and 00013 migration files, no table was actually created in the database. Would this be something to do with the Middleware?

Edit: i double checked django-migration tables in both production and public database. Neither showed any row with app_name = flags. Run migration will just show no migration to run or no change in the app "flags".

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