Skip to content

feat(backend): add commits schema and update_db snapshot (#2089) - #2106

Open
alanpeixinho wants to merge 3 commits into
kernelci:mainfrom
profusion:feat/2089-commits-schema
Open

alanpeixinho wants to merge 3 commits into
kernelci:mainfrom
profusion:feat/2089-commits-schema

Conversation

@alanpeixinho

Copy link
Copy Markdown
Contributor

What it is

Add a commits table (int PK, unique git_commit_hash, nullable author/committer/subject/message/fetched_from_url) and commit_parents (ord=0 = first parent, unique (commit_id, ord)). Checkouts join on git_commit_hash.

update_db snapshots and restores both tables in full (no time or origin window) so ancestors without a checkout in the interval stay in the first-parent chain. Rows stream in SELECT_BATCH_SIZE batches. Surrogate ids are kept.

Closes #2089

How to test

  • Apply migration 0021. Confirm commits and commit_parents exist.
  • Run update_db snapshot with a tight --start-interval. Commits and parents should still be the full tables.
  • Truncate those tables, restore the snapshot, and check counts, ids, and that the next insert does not collide with existing ids.

Made with Cursor

@felipebergamin

Copy link
Copy Markdown
Member

looking good.
how do you think we should follow? merge this to main or create a "feature branch" to release everything together when all the tasks are done?

@alanpeixinho

Copy link
Copy Markdown
Contributor Author

looking good. how do you think we should follow? merge this to main or create a "feature branch" to release everything together when all the tasks are done?

Up until now, we have always directly merged to main. But it might be a good idea to have feature branches for such cases.

* Add `Commits` model: unique `git_commit_hash`, nullable author/committer/subject/message/`fetched_from_url`
* Add `CommitParents` model: FKs to `commits.id`, `ord` with 0 = first parent, unique `(commit_id, ord)`
* Add migration `0021_commits_and_commit_parents` (`commits`, `commit_parents` tables and indexes)
* Join from `checkouts.git_commit_hash` without new checkout columns

Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
Dump commits and commit_parents in full so git ancestry survives restore.

Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
…ci#2089)

Keep commits rows narrow: unique git name/email in commit_identity, subject plus UTF-8 body in commit_message as bytea. update_db dumps and restores the new tables and still accepts a flat legacy commits CSV.
@alanpeixinho
alanpeixinho force-pushed the feat/2089-commits-schema branch from bc370a8 to 3b018c1 Compare September 23, 2026 12:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#2079] Add commits and commit_parents tables

2 participants