Remove dev servers (#19638)

TODO:

- [ ] Check that workspace migration worked
- [ ] Add server migrations and make sure SeaORM files are in sync
(maybe?)

Release Notes:

- N/A

---------

Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Mikayla Maki 2024-10-24 11:14:03 -07:00 committed by GitHub
parent b5f816dde5
commit 02718284ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 391 additions and 5024 deletions

View file

@ -4,7 +4,6 @@ use crate::{
};
use anyhow::{Context, Result};
use async_recursion::async_recursion;
use client::DevServerProjectId;
use db::sqlez::{
bindable::{Bind, Column, StaticColumnCount},
statement::Statement,
@ -17,7 +16,6 @@ use std::{
path::{Path, PathBuf},
sync::Arc,
};
use ui::SharedString;
use util::ResultExt;
use uuid::Uuid;
@ -92,13 +90,6 @@ impl Column for SerializedSshProject {
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct SerializedDevServerProject {
pub id: DevServerProjectId,
pub dev_server_name: String,
pub paths: Vec<SharedString>,
}
#[derive(Debug, PartialEq, Clone)]
pub struct LocalPaths(Arc<Vec<PathBuf>>);
@ -176,49 +167,10 @@ impl Column for LocalPathsOrder {
}
}
impl From<SerializedDevServerProject> for SerializedWorkspaceLocation {
fn from(dev_server_project: SerializedDevServerProject) -> Self {
Self::DevServer(dev_server_project)
}
}
impl StaticColumnCount for SerializedDevServerProject {}
impl Bind for &SerializedDevServerProject {
fn bind(&self, statement: &Statement, start_index: i32) -> Result<i32> {
let next_index = statement.bind(&self.id.0, start_index)?;
let next_index = statement.bind(&self.dev_server_name, next_index)?;
let paths = serde_json::to_string(&self.paths)?;
statement.bind(&paths, next_index)
}
}
impl Column for SerializedDevServerProject {
fn column(statement: &mut Statement, start_index: i32) -> Result<(Self, i32)> {
let id = statement.column_int64(start_index)?;
let dev_server_name = statement.column_text(start_index + 1)?.to_string();
let paths = statement.column_text(start_index + 2)?.to_string();
let paths: Vec<SharedString> = if paths.starts_with('[') {
serde_json::from_str(&paths).context("JSON deserialization of paths failed")?
} else {
vec![paths.into()]
};
Ok((
Self {
id: DevServerProjectId(id as u64),
dev_server_name,
paths,
},
start_index + 3,
))
}
}
#[derive(Debug, PartialEq, Clone)]
pub enum SerializedWorkspaceLocation {
Local(LocalPaths, LocalPathsOrder),
Ssh(SerializedSshProject),
DevServer(SerializedDevServerProject),
}
impl SerializedWorkspaceLocation {