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

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

  # rubocop:disable Migration/PreventStrings
  def change
    create_table :operations_scopes do |t|
      t.references :strategy, null: false, index: false, foreign_key: { to_table: :operations_strategies, on_delete: :cascade }
      t.string :environment_scope, null: false, limit: 255
    end

    add_index :operations_scopes, [:strategy_id, :environment_scope], unique: true
  end
  # rubocop:enable Migration/PreventStrings
end