summaryrefslogtreecommitdiff
path: root/db/migrate/20230427094534_create_analytics_value_stream_dashboard_aggregations.rb
blob: fd6528790ca7abee415430ff2c7c7e7de1b2b8ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

class CreateAnalyticsValueStreamDashboardAggregations < Gitlab::Database::Migration[2.1]
  def change
    create_table :value_stream_dashboard_aggregations, id: false do |t|
      t.references :namespace, primary_key: true, null: false, index: false, foreign_key: { on_delete: :cascade }
      t.datetime_with_timezone :last_run_at
      t.boolean :enabled, null: false, default: true

      t.index [:last_run_at, :namespace_id], where: 'enabled IS TRUE',
        name: 'index_on_value_stream_dashboard_aggregations_last_run_at_id'
    end
  end
end