Skip to content

Backfill default_branch_protection_defaults for namespace settings

What does this MR do and why?

Backfill default_branch_protection_defaults for namespace settings

This commit backfills default_branch_protection_defaults for namespace settings table

Changelog: other

Query Logs

Read Query https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/23716/commands/76137

Write Query https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/23716/commands/76140

Migration Logs

rails db:migrate
main: == [advisory_lock_connection] object_id: 180860, pg_backend_pid: 85619
main: == 20231107092912 QueueBackfillBranchProtectionNamespaceSetting: migrating ====
main: == 20231107092912 QueueBackfillBranchProtectionNamespaceSetting: migrated (0.0613s)

main: == [advisory_lock_connection] object_id: 180860, pg_backend_pid: 85619


❯ bundle exec rake db:rollback:main STEP=1
main: == [advisory_lock_connection] object_id: 181400, pg_backend_pid: 84882
main: == 20231107092912 QueueBackfillBranchProtectionNamespaceSetting: reverting ====
main: == 20231107092912 QueueBackfillBranchProtectionNamespaceSetting: reverted (0.0400s)

main: == [advisory_lock_connection] object_id: 181400, pg_backend_pid: 84882

How to set up and validate locally

  1. Run rails console.
  2. Enter NamespaceSetting.update_all(default_branch_protection_defaults: {})
  3. rails db:migrate
  4. Check NamespaceSetting's default_branch_protection_defaults column is correctly filled.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #408152 (closed)

Edited by Harsimar Sandhu

Merge request reports