Skip to content

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

Merged
zetter-rpf merged 1 commit into
mainfrom
good-job-cleanup
Nov 23, 2026
Merged

zetter-rpf merged 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.

@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 a legacy foreign key that blocks deletion of old job records. Current job tracking uses batch identifiers instead, and the change does not alter authorization or cleanup schedules.

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

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Test coverage

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

@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-good-job-c-6kw042 November 17, 2026 15:01 Inactive
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.
@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-good-job-c-c3lmfc November 23, 2026 13:36 Inactive
@zetter-rpf
zetter-rpf merged commit 73e4f24 into main Nov 23, 2026
10 checks passed
@zetter-rpf
zetter-rpf deleted the good-job-cleanup branch November 23, 2026 13:39

This branch was previously deployed

2 inactive (1 outdated) deployments
editor-api-p-good-job-c-c3lmfc — c0350b36 Deployed Nov 23, 2026 by raspberrypiherokubot
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.

3 participants