summaryrefslogtreecommitdiff
path: root/db/migrate/20200109030418_add_sorting_index_to_packages.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-04 12:09:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-04 12:09:00 +0000
commit88a0824944720b6edaaef56376713541b9a02118 (patch)
treef5fcc4f9755f249779cda9a8f02902d734af6e7e /db/migrate/20200109030418_add_sorting_index_to_packages.rb
parent7d19df2d34a9803d9f077c16315ba919b7ae2aa2 (diff)
downloadgitlab-ce-88a0824944720b6edaaef56376713541b9a02118.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20200109030418_add_sorting_index_to_packages.rb')
-rw-r--r--db/migrate/20200109030418_add_sorting_index_to_packages.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20200109030418_add_sorting_index_to_packages.rb b/db/migrate/20200109030418_add_sorting_index_to_packages.rb
new file mode 100644
index 00000000000..989f3de3c04
--- /dev/null
+++ b/db/migrate/20200109030418_add_sorting_index_to_packages.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddSortingIndexToPackages < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :packages_packages, [:project_id, :created_at]
+ add_concurrent_index :packages_packages, [:project_id, :version]
+ add_concurrent_index :packages_packages, [:project_id, :package_type]
+ end
+
+ def down
+ remove_concurrent_index :packages_packages, [:project_id, :created_at]
+ remove_concurrent_index :packages_packages, [:project_id, :version]
+ remove_concurrent_index :packages_packages, [:project_id, :package_type]
+ end
+end