-
-
Notifications
You must be signed in to change notification settings - Fork 239
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 ResponseType data migration #381
Fix ResponseType data migration #381
Conversation
@juanifioren Please merge this! It's preventing us from upgrading Django. |
If you can upgrade to Django 3.2 this problem is mitigated by https://code.djangoproject.com/ticket/29052 |
This migration still fails in Django 3.2, because the two ORM calls use different connections – note the different PIDs on these log lines:
Please merge this! |
If oidc provider is used in a multi database setup it may not be used on the default database alone. And when used in a database mirror setup the migration could be executed on a different db alias/transaction. This can cause migration failures because the ReponseType table is created on the database passed to the migrate command while the data is inserted in the database returned from the database router. Depending on the configuration the ResponseType table may not exist for that database yet or the ResponseType data was already migrated resulting in a DatabaseError and IntegrityError respectively.
e2d1579
to
e0db48c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! thanks for the contribution
If oidc provider is used in a multi database setup it may not be used on
the default database alone. And when used in a database mirror setup the
migration could be executed on a different db alias/transaction.
This can cause migration failures because the ReponseType table is
created on the database passed to the migrate command while the data is
inserted in the database returned from the database router.
Depending on the configuration the ResponseType table may not exist for
that database yet or the ResponseType data was already migrated
resulting in a DatabaseError and IntegrityError respectively.