Skip to content

Commit

Permalink
Update implementation for repository provider
Browse files Browse the repository at this point in the history
  • Loading branch information
boxbeam committed Apr 24, 2024
1 parent a193c9b commit 89d3e90
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ee/tabby-db/src/github_repository_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,13 @@ impl DbConn {
name: String,
git_url: String,
) -> Result<i64> {
let updated_at = Utc::now().as_sqlite_datetime();
let res = query!(
"INSERT INTO github_provided_repositories (github_repository_provider_id, vendor_id, name, git_url, updated_at) VALUES ($1, $2, $3, $4, $5)
ON CONFLICT(github_repository_provider_id, vendor_id) DO UPDATE SET name = $3, git_url = $4, updated_at = $5",
"INSERT INTO github_provided_repositories (github_repository_provider_id, vendor_id, name, git_url) VALUES ($1, $2, $3, $4)
ON CONFLICT(github_repository_provider_id, vendor_id) DO UPDATE SET name = $3, git_url = $4, updated_at = DATETIME('now')",
github_provider_id,
vendor_id,
name,
git_url,
updated_at
).execute(&self.pool).await?;
Ok(res.last_insert_rowid())
}
Expand All @@ -183,6 +181,7 @@ impl DbConn {
github_provider_id: i64,
cutoff_timestamp: DateTime<Utc>,
) -> Result<()> {
let cutoff_timestamp =cutoff_timestamp.as_sqlite_datetime();
query!(
"DELETE FROM github_provided_repositories WHERE github_repository_provider_id = ? AND updated_at < ?;",
github_provider_id,
Expand Down

0 comments on commit 89d3e90

Please sign in to comment.