diff options
Diffstat (limited to 'db/migrate/20230614180651_add_organization_id_to_namespaces.rb')
-rw-r--r-- | db/migrate/20230614180651_add_organization_id_to_namespaces.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20230614180651_add_organization_id_to_namespaces.rb b/db/migrate/20230614180651_add_organization_id_to_namespaces.rb new file mode 100644 index 00000000000..6a0048b5fc3 --- /dev/null +++ b/db/migrate/20230614180651_add_organization_id_to_namespaces.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddOrganizationIdToNamespaces < Gitlab::Database::Migration[2.1] + DEFAULT_ORGANIZATION_ID = 1 + + enable_lock_retries! + + def up + # This column already exists on some environments and it was reverted + # in MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122809 + return if column_exists?(:namespaces, :organization_id) + + add_column :namespaces, :organization_id, :bigint, default: DEFAULT_ORGANIZATION_ID, null: true # rubocop:disable Migration/AddColumnsToWideTables + end + + def down + remove_column :namespaces, :organization_id + end +end |