Sha256: 0c72258fde98646579c967a024f248988f01e0e2111eb695e16be7852f15916b

Contents?: true

Size: 840 Bytes

Versions: 3

Compression:

Stored size: 840 Bytes

Contents

class AddMoreColumnTypesToWands < ActiveRecord::Migration["#{ENV['RAILS_VERSION']}" || "5.2"]
  def change
    add_column :wands, :flexibility,    :float,   null: false, default: 0.5
    add_column :wands, :hardness,       :decimal, null: false, precision: 10, scale: 10, default: 5
    add_column :wands, :reflectance,    :decimal, null: false, precision: 10, scale: 0, default: 0.5
    add_column :wands, :broken,         :boolean, null: false, default: false
    add_column :wands, :chosen_at_date, :date
    add_column :wands, :chosen_at_time, :time
    if (
      ENV['RAILS_VERSION'] != '5.1'
      ENV['RAILS_VERSION'] != '5.0'
    ) # JSON column type is only supported on 5.2 or higher
      add_column :wands, :spell_history,  :json
      add_column :wands, :maker_info,     :json,    null: false, default: '{}'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sorbet-rails-0.5.0 spec/support/rails_shared/db/migrate/20190622000000_add_more_column_types_to_wands.rb
sorbet-rails-0.4.0 spec/support/rails_shared/db/migrate/20190622000000_add_more_column_types_to_wands.rb
sorbet-rails-0.3.0 spec/support/rails_shared/db/migrate/20190622000000_add_more_column_types_to_wands.rb