summaryrefslogtreecommitdiff
path: root/db/post_migrate
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-27 09:08:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-27 09:08:28 +0000
commit6ac4a6713ed3196af899011f7e18658e16ebaac0 (patch)
treec60237cb5203d171481b765d31bfead080d063cf /db/post_migrate
parentd2b64c37bdef067656fdc8deb4728a2fbc6c2729 (diff)
downloadgitlab-ce-6ac4a6713ed3196af899011f7e18658e16ebaac0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20200323011225_complete_migrate_security_scans.rb13
-rw-r--r--db/post_migrate/20200323011955_remove_index_used_for_scan_migration.rb24
2 files changed, 37 insertions, 0 deletions
diff --git a/db/post_migrate/20200323011225_complete_migrate_security_scans.rb b/db/post_migrate/20200323011225_complete_migrate_security_scans.rb
new file mode 100644
index 00000000000..39c9a78b1b6
--- /dev/null
+++ b/db/post_migrate/20200323011225_complete_migrate_security_scans.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class CompleteMigrateSecurityScans < ActiveRecord::Migration[6.0]
+ disable_ddl_transaction!
+
+ def up
+ Gitlab::BackgroundMigration.steal('MigrateSecurityScans')
+ end
+
+ def down
+ # intentionally blank
+ end
+end
diff --git a/db/post_migrate/20200323011955_remove_index_used_for_scan_migration.rb b/db/post_migrate/20200323011955_remove_index_used_for_scan_migration.rb
new file mode 100644
index 00000000000..0568cdb8483
--- /dev/null
+++ b/db/post_migrate/20200323011955_remove_index_used_for_scan_migration.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class RemoveIndexUsedForScanMigration < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'job_artifacts_secure_reports_temp_index'
+ COLUMNS = [:id, :file_type, :job_id, :created_at, :updated_at]
+
+ disable_ddl_transaction!
+
+ def up
+ if index_exists?(:ci_job_artifacts, COLUMNS, name: INDEX_NAME)
+ remove_concurrent_index(:ci_job_artifacts, COLUMNS, name: INDEX_NAME)
+ end
+ end
+
+ def down
+ add_concurrent_index(:ci_job_artifacts,
+ COLUMNS,
+ name: INDEX_NAME,
+ where: 'file_type BETWEEN 5 AND 8')
+ end
+end