Add migrate for base environment to sync logic

This commit is contained in:
Gregory Schier
2025-09-22 11:15:32 -07:00
parent 523e7dcf16
commit 8fe50959b9
9 changed files with 182 additions and 18 deletions

View File

@@ -26,7 +26,7 @@ impl<'a> DbContext<'a> {
let environments = self.list_environments_ensure_base(workspace_id)?;
let base_environments = environments
.into_iter()
.filter(|e| e.parent_id.is_none())
.filter(|e| e.parent_model == "workspace")
.collect::<Vec<Environment>>();
if base_environments.len() > 1 {
@@ -44,7 +44,7 @@ impl<'a> DbContext<'a> {
let mut environments =
self.find_many::<Environment>(EnvironmentIden::WorkspaceId, workspace_id, None)?;
let base_environment = environments.iter().find(|e| e.parent_id.is_none());
let base_environment = environments.iter().find(|e| e.parent_model == "workspace");
if let None = base_environment {
let e = self.upsert_environment(