1. 09 4月, 2019 9 次提交
  2. 08 4月, 2019 11 次提交
  3. 07 4月, 2019 3 次提交
    • X
      depend on Zeitwerk 2 · 57c7cbb1
      Xavier Noria 提交于
      57c7cbb1
    • L
      change `t.integer` to `t.bigint` where applicable · cdaa4bae
      lxxxvi 提交于
      cdaa4bae
    • R
      Raise `ArgumentError` for invalid `:limit` and `:precision` like as other options · 20da6c7e
      Ryuta Kamizono 提交于
      When I've added new `:size` option in #35071, I've found that invalid
      `:limit` and `:precision` raises `ActiveRecordError` unlike other
      invalid options.
      
      I think that is hard to distinguish argument errors and statement
      invalid errors since the `StatementInvalid` is a subclass of the
      `ActiveRecordError`.
      
      https://github.com/rails/rails/blob/c9e4c848eeeb8999b778fa1ae52185ca5537fffe/activerecord/lib/active_record/errors.rb#L103
      
      ```ruby
      begin
        # execute any migration
      rescue ActiveRecord::StatementInvalid
        # statement invalid
      rescue ActiveRecord::ActiveRecordError, ArgumentError
        # `ActiveRecordError` except `StatementInvalid` is maybe an argument error
      end
      ```
      
      I'd say this is the inconsistency worth fixing.
      
      Before:
      
      ```ruby
      add_column :items, :attr1, :binary,   size: 10      # => ArgumentError
      add_column :items, :attr2, :decimal,  scale: 10     # => ArgumentError
      add_column :items, :attr3, :integer,  limit: 10     # => ActiveRecordError
      add_column :items, :attr4, :datetime, precision: 10 # => ActiveRecordError
      ```
      
      After:
      
      ```ruby
      add_column :items, :attr1, :binary,   size: 10      # => ArgumentError
      add_column :items, :attr2, :decimal,  scale: 10     # => ArgumentError
      add_column :items, :attr3, :integer,  limit: 10     # => ArgumentError
      add_column :items, :attr4, :datetime, precision: 10 # => ArgumentError
      ```
      20da6c7e
  4. 06 4月, 2019 5 次提交
  5. 05 4月, 2019 12 次提交