Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
added versioning to files table
KCaverly1649cf81de4b
diff --git a/crates/vector_store/src/db.rs b/crates/vector_store/src/db.rsindex 79d90e87bf8..a91a1872b59 100644--- a/crates/vector_store/src/db.rs+++ b/crates/vector_store/src/db.rs@@ -9,6 +9,7 @@ use std::{use anyhow::{anyhow, Result};use crate::parsing::ParsedFile;+use crate::VECTOR_STORE_VERSION;use rpc::proto::Timestamp;use rusqlite::{params,@@ -72,6 +73,7 @@ impl VectorDatabase {relative_path VARCHAR NOT NULL,mtime_seconds INTEGER NOT NULL,mtime_nanos INTEGER NOT NULL,+ vector_store_version INTEGER NOT NULL,FOREIGN KEY(worktree_id) REFERENCES worktrees(id) ON DELETE CASCADE)",[],@@ -112,15 +114,16 @@ impl VectorDatabase {self.db.execute("INSERT INTO files- (worktree_id, relative_path, mtime_seconds, mtime_nanos)+ (worktree_id, relative_path, mtime_seconds, mtime_nanos, vector_store_version)VALUES- (?1, ?2, $3, $4);+ (?1, ?2, $3, $4, $5);",params![worktree_id,indexed_file.path.to_str(),mtime.seconds,- mtime.nanos+ mtime.nanos,+ VECTOR_STORE_VERSION],)?;diff --git a/crates/vector_store/src/vector_store.rs b/crates/vector_store/src/vector_store.rsindex 4b5f6b636f9..6f63f07b884 100644--- a/crates/vector_store/src/vector_store.rs+++ b/crates/vector_store/src/vector_store.rs@@ -13,14 +13,13 @@ use db::VectorDatabase;use embedding::{EmbeddingProvider, OpenAIEmbeddings};use futures::{channel::oneshot, Future};use gpui::{- AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Subscription, Task,- ViewContext, WeakModelHandle,+ AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Task, ViewContext,+ WeakModelHandle,};use language::{Language, LanguageRegistry};use modal::{SemanticSearch, SemanticSearchDelegate, Toggle};use parsing::{CodeContextRetriever, ParsedFile};use project::{Fs, PathChange, Project, ProjectEntryId, WorktreeId};-use settings::SettingsStore;use smol::channel;use std::{collections::HashMap,@@ -37,6 +36,8 @@ use util::{};use workspace::{Workspace, WorkspaceCreated};+const VECTOR_STORE_VERSION: usize = 0;+pub fn init(fs: Arc<dyn Fs>,http_client: Arc<dyn HttpClient>,