Skip to content

Add archived column to Namespaces

  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

What does this MR do and why?

This MR will add an archived column to Namespaces.

This column represents whether a ProjectNamespace, Group, or UserNamespace has been archived. This is the first step in being able to archive Groups - a hotly requested feature in Create an option to archive/unarchive Groups (#15967 - closed).

We decided to add this to Namespaces, and not NamespaceSettings, because this column will be queried for every Group query outside the admin area.

This MR will need a follow-up to add an index to the archived column.

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.

Screenshots or screen recordings

Command Output

bundle exec rake db:migrate
main: == [advisory_lock_connection] object_id: 128220, pg_backend_pid: 120037
main: == 20240620153847 AddArchivedToNamespaces: migrating ==========================
main: -- add_column(:namespaces, :archived, :boolean, {:default=>false, :null=>false})
main:    -> 0.0141s
main: == 20240620153847 AddArchivedToNamespaces: migrated (0.0210s) =================

main: == [advisory_lock_connection] object_id: 128220, pg_backend_pid: 120037

Command Output for Rollback

bundle exec rake db:migrate:down:main VERSION=20240620153847
main: == [advisory_lock_connection] object_id: 127720, pg_backend_pid: 121336
main: == 20240620153847 AddArchivedToNamespaces: reverting ==========================
main: -- remove_column(:namespaces, :archived, :boolean, {:default=>false, :null=>false})
main:    -> 0.0164s
main: == 20240620153847 AddArchivedToNamespaces: reverted (0.0265s) =================

main: == [advisory_lock_connection] object_id: 127720, pg_backend_pid: 121336

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Run the database migration - bundle exec rake db:migrate
  2. Confirm there is a new column on the Namespaces table

Related to #15967 (closed)

Edited by Rachael Wright-Munn

Merge request reports

Loading