gitlab-org--gitlab-foss/db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
506 B
Ruby
Raw Normal View History

# 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