opensafely-core / opensafely-core/reference-gateway
Fix fetch_github_data to handle deleted repos
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Currently, the db model has project id as a primary key, and a unique constraint on the name.
However, it does not remove repos if they are no longer present. This makes sense, given its acting as an audit trail.
However, if a user deletes a repo, and then creates a project with the same name, (e.g. repeatedly creating and deleting a demo project for filming video, for instance), this breaks the import, and it tries to import a new project id, but has the same name as an existing one.
A possible and arguably correct change would be a compound primary key of (id, name), but that's not always easy in django.
Maybe we want to add an "archived" feature, and have repos that no longer exist be archived projects
Beyond the import/db question, there's also one of how to present this information to the user.
The archiving approach perhaps helps here.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with fetch_github_data and the database model described in the issue, focusing on the project-id primary key and unique name constraint. Review how deleted repositories and newly recreated repositories are represented during import. Done means the import handles a deleted-and-recreated repository without a name conflict, with the resulting presentation behavior decided.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100