Files
sciagent/be0/migrations/024_imagehub_dataset_project_link.sql
T
Thinh Lam 688fac73e9
CI/CD / backend (push) Failing after 2m8s
CI/CD / frontend (push) Failing after 1m40s
CI/CD / deploy (push) Has been skipped
sciagent code + Gitea Actions CI/CD
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 09:38:30 +07:00

14 lines
914 B
SQL

-- ImageHub: link a dataset to a research project (the "workspace" superstructure). Nullable,
-- so existing datasets stay unlinked and a dataset can still exist standalone. A dataset created
-- from a project cockpit attaches to that project. ON DELETE SET NULL so deleting a project
-- orphans its datasets rather than dropping the imaging data. Idempotent. Apply after 023
-- (no semicolons inside comments or string literals — the runner splitter is naive):
-- docker exec -i initiative-postgres psql -U initiative -d initiatives < be0/migrations/024_imagehub_dataset_project_link.sql
ALTER TABLE imagehub_datasets
ADD COLUMN IF NOT EXISTS research_project_id UUID REFERENCES research_projects(id) ON DELETE SET NULL;
-- "Datasets in this project" lookup (the project-scoped dataset list).
CREATE INDEX IF NOT EXISTS idx_imagehub_datasets_research_project
ON imagehub_datasets (research_project_id);