learningequality / learningequality/morango

Drop foreign key constraint to Store table

Open
#168 1 comment 0 reactions 1 assignee View on GitHub

@bjester is already working on this.

Since Jun 7, 2022.

DEV: backend
Dominant language
Python
Stars
15
Forks
23
PR merge metrics
No merged PRs in 30d

Description

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+

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.