Skip to content

Commit

Permalink
update query if project id exists
Browse files Browse the repository at this point in the history
ayobi committed Aug 29, 2024
1 parent 92785c4 commit 7e75e08
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion microsetta_private_api/db/patches/0142.sql
Original file line number Diff line number Diff line change
@@ -4,8 +4,15 @@

WITH all_observations AS (
SELECT observation_id FROM barcodes.sample_observations
),
add_projects AS (
SELECT project_id
FROM (VALUES (118), (160)) AS np(project_id)
WHERE EXISTS (
SELECT 1 FROM barcodes.project WHERE project.project_id = np.project_id
)
)
INSERT INTO barcodes.sample_observation_project_associations (observation_id, project_id)
SELECT observation_id, project_id
FROM all_observations
CROSS JOIN (VALUES (118), (160)) AS new_projects(project_id);
CROSS JOIN add_projects;

0 comments on commit 7e75e08

Please sign in to comment.