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 migrations when used in condition with a custom DB. #313

Merged

Conversation

niallmcandrew-work
Copy link

We have recently picked up Knox to use it within one of our projects that uses custom databases during its testing steps. While our setup isn't the most common. it is supported by Django. Unfortunately when using a custom DB the 0006_auto_20160818_0932.py fails to run because the ORM call doesn't respect the schemas DB connection.

The fix included here just sets the connection alias to respect that configured by the schema. This doesn't effect anyone using the standard DB and doesn't effect anyone who already has the migration install, however allows users with a custom DB connection to now run the migration.

Thanks for the great package you provide. Please let me know if you require any further clarification.

@giovannicimolin
Copy link
Contributor

@niall-madecurious Thanks for the contribution! I'll review it in the next few days.

Copy link
Contributor

@giovannicimolin giovannicimolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Looks good, thanks for the contribution!

@giovannicimolin giovannicimolin merged commit bc7c284 into jazzband:develop Oct 10, 2023
6 checks passed
@giovannicimolin
Copy link
Contributor

@niall-madecurious I still don't have access to the pypi package, so I can't create a new release.
You can follow #304 for updates on that.

@niallmcandrew-work niallmcandrew-work deleted the fix-migrations-on-custom-db branch October 10, 2023 20:04
@niallmcandrew-work
Copy link
Author

Thanks @giovannicimolin for the notice on release issues. I'll follow #304 and pull from git for now.

dontexit pushed a commit to dontexit/django-rest-knox that referenced this pull request Jan 24, 2024
…ustom-db

Fix migrations when used in condition with a custom DB.
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.

2 participants