Pass organization_id when creating OAuth Applications
What does this MR do and why?
Backport of !9548 (merged) to 19-1-stable.
Adds DEFAULT_ORGANIZATION_ID = 1 and updates create_or_find_authorization to:
- Pass
organization_id: DEFAULT_ORGANIZATION_IDin thecreate!call for newly created OAuth applications. - Backfill
organization_idviaupdate_columnfor existing apps with a NULLorganization_idfound duringgitlab-ctl reconfigure.
This fixes a PG::CheckViolation on the check_77eda6baaa constraint of the oauth_applications table enforced by the post-deploy migration add_not_null_constraint_to_oauth_applications_organization_id, which causes post_deploy_db_migrations to fail during 19.x upgrades.
See https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/team/-/work_items/12901#note_3490075217 for the original report from GitLab Dedicated.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
- The original MR has been deployed to GitLab.com (not applicable for documentation or spec changes).
- This MR has a severity label assigned (if applicable).
Note to the merge request author and maintainer
If you have questions about the patch release process, please:
- Refer to the patch release runbook for engineers and maintainers for guidance.
- Ask questions on the
#releasesSlack channel (internal only).