summaryrefslogtreecommitdiff
path: root/db/migrate/20201021102554_create_analytics_devops_adoption_segment_selections.rb
blob: c5aac7a82a59fafaaade7aa5f1e1e4fe6db00540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class CreateAnalyticsDevopsAdoptionSegmentSelections < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  def change
    create_table :analytics_devops_adoption_segment_selections do |t|
      t.references :segment, index: { name: 'index_on_segment_selections_segment_id' }, null: false, foreign_key: { to_table: :analytics_devops_adoption_segments, on_delete: :cascade }
      t.bigint :group_id
      t.bigint :project_id
      t.index [:group_id, :segment_id], unique: true, name: 'index_on_segment_selections_group_id_segment_id'
      t.index [:project_id, :segment_id], unique: true, name: 'index_on_segment_selections_project_id_segment_id'

      t.timestamps_with_timezone
    end
  end
end