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

Multiple MySQL database support #50

Open
stefpiatek opened this issue Nov 1, 2017 · 0 comments
Open

Multiple MySQL database support #50

stefpiatek opened this issue Nov 1, 2017 · 0 comments

Comments

@stefpiatek
Copy link

I've got a problem when I try to migrate an auditlogged model that isn't in the same MySQL database as the User table. It creates the table but then can't create the foreign key constraint and raises and IntegrityError

django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')

Tried with with Django 1.8 on Python 2.7 and Django 1.11 on Python 3.6, MySQL databases require the auditlogged model to be in the same database as the User table. SQLite databases don't have a problem here.

I've made a minimal example gist and hopefully I'm not missing something obvious.

After downloading set up virtual env

virtualenv .env
source .env/bin/activate
pip install -r pip_requirements.txt

Migration of default database

python manage.py migrate

Migrate second database with auditlogged model, raises IntegrityError

python manage.py migrate second --database=second
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

1 participant