Add FK constraints to database
- Dominant language
- Python
- Stars
- 9
- Forks
- 31
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 16
Description
Currently nothing is enforced, so there can be a test without its build and if we don't know its build, we don't know its checkout, we don't know its tree, do we really need to keep this record in the database? And it's not just about tests (though we have 3M+ rows of tests without existing builds on kcidb/gcloud, check attached image), builds can be related to nonexistent checkouts, incidents can be related to nonexistent tests/builds/issues
The query complexity won't change because of FKs alone, we are already able to retrieve the data that we need without them. The performance honestly might not be affected by as much as I thought, maybe just adding more indexes will do.
My reasoning is that it's about avoiding unnecessary data in the db and also about making those orphan tests reachable, because unless someone knows a test ID, they won't be able to check an orphan test's data.
**DISCUSSION FIRST**
Contributor guide
Research direction
No files, tests, or entry points are named. The issue explicitly calls for discussion first; resolve the foreign-key design and orphan-record behavior before identifying implementation work and completion criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100