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

fix: do not fail in initial migrations if PG_EXTRA_SEARCH_PATHS … #622

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zvolsky
Copy link

@zvolsky zvolsky commented Feb 17, 2020

Do not fail in initial migrations if PG_EXTRA_SEARCH_PATHS is defined.

If we have empty database (like after DROP/CREATE DATABASE), the table for tenant model is not created yet and in old code all ./manage.py commands (like migrate_schemas) will fail. Worse: The error message is not very descriptive so it is not much easy find a workaround (which is temporary comment out PG_EXTRA_SEARCH_PATHS in settings).

This merge request should handle this so the code will run during initial migrations and no change in settings is needed.

In new code we just check if the (tenant) table exists in database.

Best regards,
Mirek

@zvolsky
Copy link
Author

zvolsky commented Feb 17, 2020

Please close the older related #542

@zvolsky
Copy link
Author

zvolsky commented May 28, 2020

Seems this will be accepted never.
So good solution is following code in your settings:

import sys
if 'manage.py migrate' not in ' '.join(sys.argv).replace('makemigrations', 'migrate'):
    PG_EXTRA_SEARCH_PATHS = ['extensions']

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

Successfully merging this pull request may close these issues.

1 participant