Skip to content

Remove foreign key constraint preventing deletion of old jobs - #1119

Open
zetter-rpf wants to merge 1 commit into
mainfrom
good-job-cleanup
Open

zetter-rpf wants to merge 1 commit into
mainfrom
good-job-cleanup

Conversation

@zetter-rpf

@zetter-rpf zetter-rpf commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Related to: https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1903

When the user jobs table was made they were linked to a job, but since 2025-10-28 they have only been linked to batches.

I've manually set the good_job_id to null for all records on the user_jobs table so we can clean up old jobs. This change just makes sure that if we set good_job_id in the future, it doesn't prevent jobs being deleted.

Having this constraint prevents good job from tidying up old jobs. I've confirmed that user jobs can not have a good_job_id (or one that doesn't refer to a job that exists) and still work.

When the user jobs table was made they were linked to a job, but since 2025-10-28 they have only been linked to batches.

Having this constraint prevents good job from tidying up old jobs.
@cla-bot cla-bot Bot added the cla-signed label Nov 17, 2026
@zetter-rpf
zetter-rpf marked this pull request as ready for review November 17, 2026 14:58
@macroscopeapp

macroscopeapp Bot commented Nov 17, 2026

Copy link
Copy Markdown

Approvability

Verdict: Would Approve

Macroscope's review found this PR approvable — Removes an obsolete foreign key that blocks old job deletion. Current job tracking uses batch IDs, and the change does not itself delete records or alter cleanup policy.

Needs human approval because:

  • approvability is in preview mode for this repository — Macroscope would have approved this PR outside preview mode

You can add or adjust custom eligibility rules. Learn more.

@github-actions

Copy link
Copy Markdown

Test coverage

94.19% line coverage reported by SimpleCov.
Run: https://github.com/RaspberryPiFoundation/editor-api/actions/runs/44108717256

This branch was successfully deployed

1 active deployment
editor-api-p-good-job-c-6kw042 — 7a41fec0 Deployed Nov 17, 2026 by raspberrypiherokubot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants