Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions helm/folio-db/sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ JOIN projects p ON s.project_id = p.id AND p.deleted_at IS NULL
LEFT JOIN pathogens pat ON p.pathogen_id = pat.id AND pat.deleted_at IS NULL
WHERE s.deleted_at IS NULL;

CREATE OR REPLACE VIEW organisation_projects AS
SELECT
o.id as organisation_id,
o.name as organisation_name,
COUNT(p.id) as project_count
FROM organisations o
LEFT JOIN projects p ON o.id = p.organisation_id AND p.deleted_at IS NULL
WHERE o.deleted_at IS NULL
GROUP BY o.id, o.name;
-- CREATE OR REPLACE VIEW organisation_projects AS
-- SELECT
-- o.id as organisation_id,
-- o.name as organisation_name,
-- COUNT(p.id) as project_count
-- FROM organisations o
-- LEFT JOIN projects p ON o.id = p.organisation_id AND p.deleted_at IS NULL
-- WHERE o.deleted_at IS NULL
-- GROUP BY o.id, o.name;

COMMENT ON TABLE pathogens IS 'Reference table for pathogen information';
COMMENT ON TABLE projects IS 'Main projects table containing project metadata';
Expand Down