Add NOT NULL constraint on project.organization_id column
What does this MR do and why?
Adds a NOT NULL constraint on the projects.organization_id column. This guarantees that projects would always belong to an organization moving forward (Organizations For Cells Blueprint)
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- Closes #502514 (closed)
- Closes #499665 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
N/A
How to set up and validate locally
- Run the migrations by running
bin/rails db:migrate RAILS_ENV=development - A not null constraint should be added to the projects table. This can be verified using the following query:
SELECT
c.conname AS constraint_name,
t.relname AS table_name,
pg_get_constraintdef(c.oid) AS constraint_definition
FROM
pg_constraint c
JOIN
pg_class t ON c.conrelid = t.oid
JOIN
pg_namespace n ON t.relnamespace = n.oid
WHERE
c.conname = 'check_1a6f946a8a';
Edited by Shane Maglangit