blob: 02cc967620229720da8cf46709e37a516152536c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# frozen_string_literal: true
class RemoveCreatedByUserIdFromClusterProvidersAws < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_cluster_providers_aws_on_created_by_user_id'
disable_ddl_transaction!
def up
with_lock_retries do
remove_column :cluster_providers_aws, :created_by_user_id
end
end
def down
unless column_exists?(:cluster_providers_aws, :created_by_user_id)
add_column :cluster_providers_aws, :created_by_user_id, :integer
end
add_concurrent_index :cluster_providers_aws, :created_by_user_id, name: INDEX_NAME
add_concurrent_foreign_key :cluster_providers_aws, :users, column: :created_by_user_id, on_delete: :nullify
end
end
|