fix(workbench): bind postgres workspace created timestamp

This commit is contained in:
Codex
2026-06-01 22:00:16 +08:00
parent 4691780b7a
commit 99aeb99991
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -52,6 +52,7 @@ test("Postgres workspace update query preserves parameter numbering", async () =
const update = calls.find((call) => call.sql.startsWith("UPDATE account_workspaces"));
assert.ok(update);
assert.match(update.sql, /created_at=\$16, updated_at=\$17/u);
assert.match(update.sql, /\$18::text = 'admin'/u);
assert.equal(update.params.length, 18);
assert.equal(update.params[15], "2026-06-01T00:00:00.000Z");
+1 -1
View File
@@ -1606,7 +1606,7 @@ class PostgresAccessStore extends MemoryAccessStore {
if (!current) return null;
const now = input.now ?? this.now();
const workspace = normalizeWorkspaceRecord(input, current, now, { replaceJson: input.replaceJson === true });
const result = await this.query("UPDATE account_workspaces SET project_id=$3, name=$4, status=$5, is_default=$6, selected_conversation_id=$7, selected_agent_session_id=$8, selected_device_pod_id=$9, active_trace_id=$10, provider_profile=$11, workspace_json=$12, revision=$13, updated_by_session_id=$14, updated_by_client=$15, updated_at=$17 WHERE id=$1 AND ($18::text = 'admin' OR owner_user_id=$2) RETURNING *", [...workspaceParams(workspace), textOr(input.actorRole, "user")]);
const result = await this.query("UPDATE account_workspaces SET project_id=$3, name=$4, status=$5, is_default=$6, selected_conversation_id=$7, selected_agent_session_id=$8, selected_device_pod_id=$9, active_trace_id=$10, provider_profile=$11, workspace_json=$12, revision=$13, updated_by_session_id=$14, updated_by_client=$15, created_at=$16, updated_at=$17 WHERE id=$1 AND ($18::text = 'admin' OR owner_user_id=$2) RETURNING *", [...workspaceParams(workspace), textOr(input.actorRole, "user")]);
return pgWorkspace(result.rows?.[0]);
}
}