Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 17:34:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 17:34:42 +0300
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb')
-rw-r--r--db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb b/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb
new file mode 100644
index 00000000000..e669faa7fca
--- /dev/null
+++ b/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class ChangeProjectIndexOnVulnerabilityExports < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ OLD_INDEX_NAME = 'index_vulnerability_exports_on_project_id_and_id'
+ NEW_INDEX_NAME = 'index_vulnerability_exports_on_project_id_not_null'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:vulnerability_exports, :project_id, where: 'project_id IS NOT NULL', name: NEW_INDEX_NAME)
+ remove_concurrent_index_by_name(:vulnerability_exports, OLD_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:vulnerability_exports, [:project_id, :id], unique: true, name: OLD_INDEX_NAME)
+ remove_concurrent_index_by_name(:vulnerability_exports, NEW_INDEX_NAME)
+ end
+end