Add a migration to limit group visibility by organization visibility
What does this MR do and why?
In 2a315ba6, we made the application changes to limit the group visibility by its organization visibility.
Here, we're migrating existing groups that have visibility more than the organization's visibility to private.
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.
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.
Query plans
- https://console.postgres.ai/gitlab/gitlab-production-main/sessions/35965/commands/111020
- https://console.postgres.ai/gitlab/gitlab-production-main/sessions/35965/commands/111021
Migration output
up
❯ bin/rails db:migrate
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/abdul/gitlab/gdk/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 133000, pg_backend_pid: 83279
main: == 20250130093913 QueueLimitNamespaceVisibilityByOrganizationVisibility: migrating
main: == 20250130093913 QueueLimitNamespaceVisibilityByOrganizationVisibility: migrated (0.0605s)
main: == [advisory_lock_connection] object_id: 133000, pg_backend_pid: 83279
ci: == [advisory_lock_connection] object_id: 133380, pg_backend_pid: 83282
ci: == 20250130093913 QueueLimitNamespaceVisibilityByOrganizationVisibility: migrating
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main_cell].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_internal, :gitlab_shared].
ci: == 20250130093913 QueueLimitNamespaceVisibilityByOrganizationVisibility: migrated (0.0855s)
ci: == [advisory_lock_connection] object_id: 133380, pg_backend_pid: 83282
down
❯ VERSION=20250130093913 bin/rails db:migrate:down:main && VERSION=20250130093913 bin/rails db:migrate:down:ci
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/abdul/gitlab/gdk/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 130040, pg_backend_pid: 78701
main: == [advisory_lock_connection] object_id: 130040, pg_backend_pid: 78701
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/abdul/gitlab/gdk/gitlab/config/environment.rb:7)
ci: == [advisory_lock_connection] object_id: 130040, pg_backend_pid: 79117
ci: == 20250130093913 QueueLimitNamespaceVisibilityByOrganizationVisibility: reverting
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main_cell].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_internal, :gitlab_shared].
ci: == 20250130093913 QueueLimitNamespaceVisibilityByOrganizationVisibility: reverted (0.0110s)
ci: == [advisory_lock_connection] object_id: 130040, pg_backend_pid: 79117
How to set up and validate locally
bin/rails db:migrate
and run the specs as well.
Related to #515933 (closed)
Edited by Abdul Wadood