python: Fix toolchain serialization not working with multiple venvs in a single worktree (#36035)
Our database did not allow more than entry for a given toolchain for a single worktree (due to incorrect primary key) Co-authored-by: Lukas Wirth <lukas@zed.dev> Release Notes: - Python: Fixed toolchain selector not working with multiple venvs in a single worktree. Co-authored-by: Lukas Wirth <lukas@zed.dev>
This commit is contained in:
parent
b61b71405d
commit
13bf45dd4a
1 changed files with 18 additions and 3 deletions
|
@ -542,6 +542,20 @@ define_connection! {
|
||||||
ALTER TABLE breakpoints ADD COLUMN condition TEXT;
|
ALTER TABLE breakpoints ADD COLUMN condition TEXT;
|
||||||
ALTER TABLE breakpoints ADD COLUMN hit_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| {
|
self.write(move |conn| {
|
||||||
let mut insert = conn
|
let mut insert = conn
|
||||||
.exec_bound(sql!(
|
.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 DO
|
ON CONFLICT DO
|
||||||
UPDATE SET
|
UPDATE SET
|
||||||
name = ?5,
|
name = ?5,
|
||||||
path = ?6
|
path = ?6,
|
||||||
|
raw_json = ?7
|
||||||
))
|
))
|
||||||
.context("Preparing insertion")?;
|
.context("Preparing insertion")?;
|
||||||
|
|
||||||
|
@ -1444,6 +1458,7 @@ impl WorkspaceDb {
|
||||||
toolchain.language_name.as_ref(),
|
toolchain.language_name.as_ref(),
|
||||||
toolchain.name.as_ref(),
|
toolchain.name.as_ref(),
|
||||||
toolchain.path.as_ref(),
|
toolchain.path.as_ref(),
|
||||||
|
toolchain.as_json.to_string(),
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue