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:
Diffstat (limited to 'db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb')
-rw-r--r--db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb b/db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb
new file mode 100644
index 00000000000..26727b7ad7d
--- /dev/null
+++ b/db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionSnapshotsIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'idx_analytics_devops_adoption_snapshots_finalized'
+
+ def up
+ add_concurrent_index :analytics_devops_adoption_snapshots, [:namespace_id, :end_time], where: "recorded_at >= end_time", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :analytics_devops_adoption_snapshots, INDEX_NAME
+ end
+end