2020-04-30 02:10:03 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class DropNamespacesPlanId < ActiveRecord::Migration[6.0]
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
2020-05-04 05:09:36 -04:00
|
|
|
with_lock_retries do
|
2020-04-30 02:10:03 -04:00
|
|
|
remove_column :namespaces, :plan_id
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
unless column_exists?(:namespaces, :plan_id)
|
2020-05-04 05:09:36 -04:00
|
|
|
with_lock_retries do
|
2020-04-30 02:10:03 -04:00
|
|
|
add_column :namespaces, :plan_id, :integer
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
add_concurrent_index :namespaces, :plan_id
|
|
|
|
add_concurrent_foreign_key :namespaces, :plans, column: :plan_id, on_delete: :nullify
|
|
|
|
end
|
|
|
|
end
|