blob: a3e60b8785798020d21680f08459456861c1b46d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
class AddGroupIdIndexAndFkToVulnerabilityExports < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
GROUP_ID_INDEX_NAME = 'index_vulnerability_exports_on_group_id_not_null'
disable_ddl_transaction!
def up
add_concurrent_index(:vulnerability_exports, :group_id, where: 'group_id IS NOT NULL', name: GROUP_ID_INDEX_NAME)
add_concurrent_foreign_key(:vulnerability_exports, :namespaces, column: :group_id)
end
def down
remove_foreign_key(:vulnerability_exports, column: :group_id)
remove_concurrent_index_by_name(:vulnerability_exports, GROUP_ID_INDEX_NAME)
end
end
|