-
Notifications
You must be signed in to change notification settings - Fork 0
server: implement SqliteStore database storage backend #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| -- SQLite Schema for Commit Cloud Server | ||
|
|
||
| -- Repository registration table for tracking active Commit Cloud repos | ||
| -- Used when running `jj cc init` to register a new remote repository | ||
| CREATE TABLE IF NOT EXISTS repos ( | ||
| repo_id TEXT PRIMARY KEY, | ||
| name TEXT, | ||
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP | ||
| ); | ||
|
|
||
| -- Commit objects store for serialized commit metadata and history nodes | ||
| -- Used when reading and writing commits during change history operations | ||
| CREATE TABLE IF NOT EXISTS commits ( | ||
| repo_id TEXT NOT NULL, | ||
| commit_id BLOB NOT NULL, | ||
| data BLOB NOT NULL, | ||
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (repo_id, commit_id) | ||
| ); | ||
|
|
||
| -- Operation objects store for Jujutsu's operation log graph entries | ||
| -- Used when recording repository state transitions and running operation log queries | ||
| CREATE TABLE IF NOT EXISTS operations ( | ||
| repo_id TEXT NOT NULL, | ||
| op_id BLOB NOT NULL, | ||
| data BLOB NOT NULL, | ||
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (repo_id, op_id) | ||
| ); | ||
|
|
||
| -- Operation heads tracking table for resolving the latest operation heads | ||
| -- Used during op log updates to advance the repository operation head pointers | ||
| CREATE TABLE IF NOT EXISTS op_heads ( | ||
| repo_id TEXT NOT NULL, | ||
| op_id BLOB NOT NULL, | ||
| updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (repo_id, op_id) | ||
| ); | ||
|
|
||
| -- Directory tree objects store for serialized directory trees and entry lists | ||
| -- Used during snapshotting and tree walking to resolve directory hierarchies | ||
| CREATE TABLE IF NOT EXISTS trees ( | ||
| repo_id TEXT NOT NULL, | ||
| tree_id BLOB NOT NULL, | ||
| data BLOB NOT NULL, | ||
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (repo_id, tree_id) | ||
| ); | ||
|
|
||
| -- File content / blob store for binary and text file contents | ||
| -- Used when reading and writing file contents for working copy snapshots and VFS reads | ||
| CREATE TABLE IF NOT EXISTS files ( | ||
| repo_id TEXT NOT NULL, | ||
| file_id BLOB NOT NULL, | ||
| data BLOB NOT NULL, | ||
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (repo_id, file_id) | ||
| ); | ||
|
|
||
| -- Symlink target metadata store for symbolic links in the repository tree | ||
| -- Used when reading and writing symlink entries in project directory trees | ||
| CREATE TABLE IF NOT EXISTS symlinks ( | ||
| repo_id TEXT NOT NULL, | ||
| symlink_id BLOB NOT NULL, | ||
| target TEXT NOT NULL, | ||
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (repo_id, symlink_id) | ||
| ); | ||
|
|
||
| -- View objects store for repository views (bookmarks, working copy commit IDs, remote refs) | ||
| -- Used when saving and loading repository state views associated with operations | ||
| CREATE TABLE IF NOT EXISTS views ( | ||
| repo_id TEXT NOT NULL, | ||
| view_id BLOB NOT NULL, | ||
| data BLOB NOT NULL, | ||
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (repo_id, view_id) | ||
| ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good.... ideaaaaallly the commit ID should actually be universally unique. So theoretically I think you could compact a little and not store the same commit twice. But doing it this way is probably fine? Same goes for most of these.
Anyway I don't think you have to change it, just interesting bit of trivia.