Repository navigation
feat(sqlite): add empty GitHub discovery tables shared with EE #9993
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
sundram-bruno
wants to merge
3
commits into
usebruno:main
Choose a base branch
from
sundram-bruno:feat/github-discovery-tables
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+436
−7
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
87 changes: 87 additions & 0 deletions
87
packages/bruno-sqlite/migrations/0000007_github_discovery.ts
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,87 @@ | ||
| // Owned by EE GitHub discovery: keep byte-identical with the EE copy. Times are epoch milliseconds. | ||
| export const up = (): string => { | ||
| return ` | ||
| CREATE TABLE IF NOT EXISTS gh_account ( | ||
| id INTEGER PRIMARY KEY CHECK (id = 1), | ||
| host TEXT NOT NULL, | ||
| user_id INTEGER NOT NULL, | ||
| login TEXT NOT NULL, | ||
| token_hash TEXT NOT NULL CHECK (length(token_hash) = 64), | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| updated_at INTEGER NOT NULL | ||
| ); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS gh_queries ( | ||
| query_key TEXT PRIMARY KEY, | ||
| kind TEXT NOT NULL, | ||
| result_count INTEGER NOT NULL, | ||
| total INTEGER, | ||
| has_next INTEGER NOT NULL, | ||
| incomplete INTEGER NOT NULL, | ||
| searched_at INTEGER NOT NULL, | ||
| last_seen INTEGER NOT NULL | ||
| ) WITHOUT ROWID; | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_gh_queries_last_seen ON gh_queries(last_seen); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS gh_query_items ( | ||
| query_key TEXT NOT NULL, | ||
| position INTEGER NOT NULL, | ||
| repo_id INTEGER, | ||
| collection_id INTEGER, | ||
| PRIMARY KEY (query_key, position), | ||
| CHECK ((repo_id IS NULL) <> (collection_id IS NULL)) | ||
| ) WITHOUT ROWID; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS gh_repos ( | ||
| repo_id INTEGER PRIMARY KEY, | ||
| full_name TEXT NOT NULL COLLATE NOCASE, | ||
| owner TEXT NOT NULL, | ||
| name TEXT NOT NULL, | ||
| description TEXT, | ||
| avatar_url TEXT, | ||
| visibility TEXT, | ||
| is_private INTEGER NOT NULL CHECK (is_private IN (0, 1)), | ||
| is_archived INTEGER NOT NULL DEFAULT 0, | ||
| default_branch TEXT, | ||
| tree_etag TEXT, | ||
| tree_checked_at INTEGER, | ||
| last_seen INTEGER NOT NULL | ||
| ); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_gh_repos_last_seen ON gh_repos(last_seen); | ||
| CREATE INDEX IF NOT EXISTS idx_gh_repos_full_name ON gh_repos(full_name COLLATE NOCASE); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS gh_collections ( | ||
| id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
| repo_id INTEGER NOT NULL, | ||
| folder_path TEXT NOT NULL, | ||
| manifest_path TEXT NOT NULL, | ||
| kind TEXT NOT NULL, | ||
| blob_oid TEXT, | ||
| request_count INTEGER, | ||
| last_seen INTEGER NOT NULL, | ||
| UNIQUE (repo_id, folder_path) | ||
| ); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_gh_collections_last_seen ON gh_collections(last_seen); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS gh_names ( | ||
| blob_oid TEXT PRIMARY KEY, | ||
| name TEXT, | ||
| last_seen INTEGER NOT NULL | ||
| ) WITHOUT ROWID; | ||
| `; | ||
| }; | ||
|
|
||
| export const down = (): string => { | ||
| return ` | ||
| PRAGMA secure_delete = ON; | ||
| DROP TABLE IF EXISTS gh_names; | ||
| DROP TABLE IF EXISTS gh_collections; | ||
| DROP TABLE IF EXISTS gh_repos; | ||
| DROP TABLE IF EXISTS gh_query_items; | ||
| DROP TABLE IF EXISTS gh_queries; | ||
| DROP TABLE IF EXISTS gh_account; | ||
| PRAGMA secure_delete = OFF; | ||
| `; | ||
| }; | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.