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

Fixes #15698: Drop and recreate FK constraints on ObjectPermission M2M tables #15765

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

jeremystretch
Copy link
Member

Fixes: #15698

Modifies the users.0008_flip_objectpermission_assignments migration to drop & recreate (rather than rename) FK constraints which may not exist in older databases.

@jeremystretch
Copy link
Member Author

I should note that I compared the resulting schema between two upgrade paths:

  • v3.7 -> branch
  • v2.11 -> 3.7 -> branch

The resulting sets of constraints are identical across both affected tables.

@tobiasge
Copy link
Member

tobiasge commented Apr 19, 2024

My tests with this PR where successful. All migrations completed on our database:

Operations to perform:
  Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, vpn, wireless
Running migrations:
  Applying dcim.0186_location_facility... OK
  Applying extras.0108_convert_reports_to_scripts... OK
  Applying extras.0109_script_model... OK
  Applying extras.0110_remove_eventrule_action_parameters... OK
  Applying extras.0111_rename_content_types... OK
  Applying extras.0112_tag_update_object_types... OK
  Applying extras.0113_customfield_rename_object_type... OK
  Applying tenancy.0015_contactassignment_rename_content_type... OK
  Applying users.0005_alter_user_table... OK
  Applying users.0006_custom_group_model... OK
  Applying users.0007_objectpermission_update_object_types... OK
  Applying users.0008_flip_objectpermission_assignments... OK
  Applying vpn.0005_rename_indexes... OK

Thank you for the fix!

@a084ed22
Copy link

a084ed22 commented Apr 19, 2024

I confirm that this fixes the issue. Migrations apply cleanly now.

@jeremystretch
Copy link
Member Author

Thank you both for the confirmation!

@jeremystretch jeremystretch merged commit 480b36d into feature Apr 19, 2024
6 checks passed
@jeremystretch jeremystretch deleted the 15698-fix-migration-missing-constraints branch April 19, 2024 12:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beta Concerns a bug/feature in a beta release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants