Draft: Add NOT NULL constraint for organization_id in scim_oauth_access_tokens
This is part of Add sharding key for `scim_oauth_access_tokens` (#553107) and a follow-up to the following MRs:
- Add `organization_id` to `scim_oauth_access_tok... (!212160 - merged)
- Backfill `organization_id` in `scim_oauth_acces... (!213936 - merged)
What does this MR do and why?
This MR adds a NOT NULL constraint on organization_id for the scim_oauth_access_tokens table to complete the Protocells compliance work.
This is the final MR in the series.
References
- Add sharding key for `scim_oauth_access_tokens` (#553107)
- Add `organization_id` to `scim_oauth_access_tok... (!212160 - merged)
- Backfill `organization_id` in `scim_oauth_acces... (!213936 - merged)
How to set up and validate locally
- Run the migration:
bundle exec rails db:migrate
- Verify the constraint exists:
ActiveRecord::Base.connection.execute(<<~SQL).to_a
SELECT conname, pg_get_constraintdef(oid)
FROM pg_constraint
WHERE conrelid = 'scim_oauth_access_tokens'::regclass
AND contype = 'c'
AND pg_get_constraintdef(oid) LIKE '%organization_id IS NOT NULL%'
SQL
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Paulo Barros