Skip to content

Commit ad1fb1b

Browse files
committed
chore: pcc sync worker wip1
Signed-off-by: Uroš Marolt <uros@marolt.me>
1 parent d616b51 commit ad1fb1b

6 files changed

Lines changed: 266 additions & 86 deletions

File tree

backend/src/database/migrations/V1775312770__pcc-sync-worker-setup.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ CREATE TABLE IF NOT EXISTS pcc_projects_sync_errors (
1818
CREATE UNIQUE INDEX IF NOT EXISTS pcc_sync_errors_dedup_idx
1919
ON pcc_projects_sync_errors (external_project_id, error_type)
2020
WHERE NOT resolved AND external_project_id IS NOT NULL;
21+
22+
-- Deduplication index for unidentifiable rows (no external_project_id).
23+
-- Keyed on (error_type, reason) so repeated daily exports don't accumulate duplicate rows
24+
-- for the same class of malformed input (e.g. rows missing PROJECT_ID/NAME/DEPTH).
25+
CREATE UNIQUE INDEX IF NOT EXISTS pcc_sync_errors_dedup_unknown_idx
26+
ON pcc_projects_sync_errors (error_type, (details->>'reason'))
27+
WHERE NOT resolved AND external_project_id IS NULL;

pnpm-lock.yaml

Lines changed: 52 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/apps/pcc_sync_worker/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"format-check": "npx prettier --check .",
1212
"tsc-check": "tsc --noEmit",
1313
"trigger-export": "SERVICE=pcc-sync-worker tsx src/scripts/triggerExport.ts",
14-
"trigger-cleanup": "SERVICE=pcc-sync-worker tsx src/scripts/triggerCleanup.ts"
14+
"trigger-export:local": "set -a && . ../../../backend/.env.dist.local && . ../../../backend/.env.override.local && set +a && SERVICE=pcc-sync-worker tsx src/scripts/triggerExport.ts",
15+
"trigger-cleanup": "SERVICE=pcc-sync-worker tsx src/scripts/triggerCleanup.ts",
16+
"trigger-cleanup:local": "set -a && . ../../../backend/.env.dist.local && . ../../../backend/.env.override.local && set +a && SERVICE=pcc-sync-worker tsx src/scripts/triggerCleanup.ts"
1517
},
1618
"dependencies": {
1719
"@crowd/archetype-standard": "workspace:*",

0 commit comments

Comments
 (0)