Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken migration for gosec_repo_scans #773

Merged
merged 2 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ services:
worker:
# NOTE: to opt out of basic image pull tracking, comment out the current image
# and uncomment the next line (which will pull from Docker Hub directly).
# image: mergestat/worker:1.12.0-beta
image: images.mergestat.com/mergestat/worker:1.12.0-beta
# image: mergestat/worker:1.13.0-beta
image: images.mergestat.com/mergestat/worker:1.13.0-beta
stop_grace_period: 10m
restart: always
depends_on:
Expand Down Expand Up @@ -50,8 +50,8 @@ services:

graphql:
# See NOTE above in worker service.
# image: mergestat/graphql:1.12.0-beta
image: images.mergestat.com/mergestat/graphql:1.12.0-beta
# image: mergestat/graphql:1.13.0-beta
image: images.mergestat.com/mergestat/graphql:1.13.0-beta
restart: always
depends_on:
postgres:
Expand Down Expand Up @@ -94,8 +94,8 @@ services:

ui:
# See NOTE above in worker service.
# image: mergestat/console:1.12.0-beta
image: images.mergestat.com/mergestat/console:1.12.0-beta
# image: mergestat/console:1.13.0-beta
image: images.mergestat.com/mergestat/console:1.13.0-beta
restart: always
depends_on:
- graphql
Expand Down
3 changes: 3 additions & 0 deletions migrations/900000000000022_fix_gosec_table.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ ADD COLUMN IF NOT EXISTS _mergestat_synced_at timestamp with time zone DEFAULT n
ALTER TABLE IF EXISTS public.gosec_repo_scans
DROP CONSTRAINT IF EXISTS gosec_repo_scans_repo_id_fkey;

--Delete any orphaned records
DELETE FROM public.gosec_repo_scans WHERE repo_id NOT IN (SELECT id FROM public.repos);

ALTER TABLE IF EXISTS public.gosec_repo_scans
ADD CONSTRAINT gosec_repo_scans_repo_id_fkey
FOREIGN KEY (repo_id) REFERENCES public.repos(id) ON UPDATE RESTRICT ON DELETE CASCADE;
Expand Down