mergestat
mergestat copied to clipboard
Make migration to take in consideration orphaned records
Basically in migration 029 we created fk on syncs but we didn't take into consideration the fact that already they where orphan syncs record without repos..
mergestat-worker-1 | ADD CONSTRAINT gitleaks_repo_id_fkey mergestat-worker-1 | FOREIGN KEY (repo_id) REFERENCES public.repos(id) ON UPDATE RESTRICT ON DELETE CASCADE; mergestat-worker-1 | mergestat-worker-1 | COMMIT; mergestat-worker-1 | (details: pq: insert or update on table "syft_repo_scans" violates foreign key constraint "syft_repo_scans_repo_id_fkey") mergestat-worker-1 | * pq: current transaction is aborted, commands ignored until end of transaction block in line 0: SELECT pg_advisory_unlock($1) mergestat-worker-1 | mergestat-worker-1 | error="2 errors occurred:\n\t* migration failed: insert or update on table \"syft_repo_scans\" violates foreign key constraint \"syft_repo_scans_repo_id_fkey\", Key (repo_id)=(df59f137-de16-4c66-852d-377de689fe0f) is not present in table \"repos\". in line 0: BEGIN;\n\nALTER TABLE public.syft_repo_scans\nADD CONSTRAINT syft_repo_scans_repo_id_fkey\nFOREIGN KEY (repo_id) REFERENCES public.repos(id) ON UPDATE RESTRICT ON DELETE CASCADE;\n\nALTER TABLE public.grype_repo_scans\nADD CONSTRAINT grype_repo_scans_repo_id_fkey\nFOREIGN KEY (repo_id) REFERENCES public.repos(id) ON UPDATE RESTRICT ON DELETE CASCADE;\n\nALTER TABLE public.git_remotes\nADD CONSTRAINT git_remotes_repo_id_fkey\nFOREIGN KEY (repo_id) REFERENCES public.repos(id) ON UPDATE RESTRICT ON DELETE CASCADE;\n\nALTER TABLE public.yelp_detect_secrets_repo_scans\nADD CONSTRAINT yelp_detect_repo_id_fkey\nFOREIGN KEY (repo_id) REFERENCES public.repos(id) ON UPDATE RESTRICT ON DELETE CASCADE;\n\nALTER TABLE public.gitleaks_repo_scans\nADD CONSTRAINT gitleaks_repo_id_fkey\nFOREIGN KEY (repo_id) REFERENCES public.repos(id) ON UPDATE RESTRICT ON DELETE CASCADE;\n\nCOMMIT;\n (details: pq: insert or update on table \"syft_repo_scans\" violates foreign key constraint \"syft_repo_scans_repo_id_fkey\")\n\t* pq: current transaction is aborted, commands ignored until end of transaction block in line 0: SELECT pg_advisory_unlock($1)\n\n" dependency failed to start: container mergestat-worker-1 exited (1)