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

Drop foreign key constraint to Store table #168

Open
bjester opened this issue Jun 6, 2022 · 1 comment
Open

Drop foreign key constraint to Store table #168

bjester opened this issue Jun 6, 2022 · 1 comment
Assignees

Comments

@bjester
Copy link
Member

bjester commented Jun 6, 2022

Background

While implementing postgres table partitioning for the morango_store table, an overlooked restriction regarding primary keys on the store table popped up. Except under specific partition strategy circumstances, primary keys cannot be enforced on partitioned tables. For the morango_store table, this would be okay, except for any foreign key references to the PK field.

Since we expect the store PK field values to be unique regardless, we'd like to drop the sole FK constraint to the field.

Deliverables

  • Update the store_model field on RecordMaxCounter to drop the FK constraint
    • The uniqueness constraint should remain and a rebuild of it should be avoided
  • Bonus: it would be great to also add an explicit on_delete=models.CASCADE to all FK fields, since the existing implicit behavior is deprecated in Django 2+
@DanielDominicSavioKennedy

I want to work on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants