diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb')
-rw-r--r-- | db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb b/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb new file mode 100644 index 00000000000..a3e60b87857 --- /dev/null +++ b/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb @@ -0,0 +1,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 |