Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
python: Fix toolchain serialization not working with multiple venvs in a single worktree (#36035)
Piotr Osiewicz13bf45dd4a77
diff --git a/crates/workspace/src/persistence.rs b/crates/workspace/src/persistence.rsindex 6fa5c969e7f..b2d1340a7b8 100644--- a/crates/workspace/src/persistence.rs+++ b/crates/workspace/src/persistence.rs@@ -542,6 +542,20 @@ define_connection! {ALTER TABLE breakpoints ADD COLUMN condition TEXT;ALTER TABLE breakpoints ADD COLUMN hit_condition TEXT;),+ sql!(CREATE TABLE toolchains2 (+ workspace_id INTEGER,+ worktree_id INTEGER,+ language_name TEXT NOT NULL,+ name TEXT NOT NULL,+ path TEXT NOT NULL,+ raw_json TEXT NOT NULL,+ relative_worktree_path TEXT NOT NULL,+ PRIMARY KEY (workspace_id, worktree_id, language_name, relative_worktree_path)) STRICT;+ INSERT INTO toolchains2+ SELECT * FROM toolchains;+ DROP TABLE toolchains;+ ALTER TABLE toolchains2 RENAME TO toolchains;+ )];}@@ -1428,12 +1442,12 @@ impl WorkspaceDb {self.write(move |conn| {let mut insert = conn.exec_bound(sql!(- INSERT INTO toolchains(workspace_id, worktree_id, relative_worktree_path, language_name, name, path) VALUES (?, ?, ?, ?, ?, ?)+ INSERT INTO toolchains(workspace_id, worktree_id, relative_worktree_path, language_name, name, path, raw_json) VALUES (?, ?, ?, ?, ?, ?, ?)ON CONFLICT DOUPDATE SETname = ?5,- path = ?6-+ path = ?6,+ raw_json = ?7)).context("Preparing insertion")?;@@ -1444,6 +1458,7 @@ impl WorkspaceDb {toolchain.language_name.as_ref(),toolchain.name.as_ref(),toolchain.path.as_ref(),+ toolchain.as_json.to_string(),))?;Ok(())