Skip to content

Commit f0328ea

Browse files
fix(server): dev database seed keeps pull request links as an array
Stripping watches set $.pullRequests from a scalar subquery, which drops the JSON subtype, so json_set stored the array as a string and seeded threads lost their pull request links. Wrap the subquery in json(). AI-assisted; verified with the tests and tools listed above.
1 parent 1d6f7c9 commit f0328ea

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎apps/server/scripts/migrate-dev-db.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,9 @@ const pruneSnapshot = Effect.fn("pruneDevDbSnapshot")(function* (input: RunMigra
382382
OR (aggregate_kind = 'project'
383383
AND stream_id NOT IN (SELECT project_id FROM kept_projects))`;
384384
yield* sql`UPDATE orchestration_v2_projection_threads
385-
SET payload_json = json_set(payload_json, '$.pullRequests', (
385+
SET payload_json = json_set(payload_json, '$.pullRequests', json((
386386
SELECT json_group_array(json_remove(link.value, '$.watch') ORDER BY link.key)
387-
FROM json_each(payload_json, '$.pullRequests') AS link))
387+
FROM json_each(payload_json, '$.pullRequests') AS link)))
388388
WHERE EXISTS (
389389
SELECT 1 FROM json_each(payload_json, '$.pullRequests') AS link
390390
WHERE json_extract(link.value, '$.watch') IS NOT NULL)`;

0 commit comments

Comments
 (0)