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:

  1. Pass organization_id: DEFAULT_ORGANIZATION_ID in the create! call for newly created OAuth applications.
  2. Backfill organization_id via update_column for existing apps with a NULL organization_id found during gitlab-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:

Edited by Shilpa Kundapur

Merge request reports

Loading