jazzband / django-rest-knox

Authentication Module for django rest auth
MIT License
1.1k stars 206 forks source link

Fix migrations when used in condition with a custom DB. #313

Closed niall-madecurious closed 9 months ago

niall-madecurious commented 9 months ago

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 commented 9 months ago

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

giovannicimolin commented 9 months ago

@niall-madecurious I still don't have access to the pypi package, so I can't create a new release. You can follow https://github.com/jazzband/django-rest-knox/issues/304 for updates on that.

niall-madecurious commented 9 months ago

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