1. 03 12月, 2017 1 次提交
  2. 01 12月, 2017 1 次提交
  3. 30 11月, 2017 1 次提交
    • G
      Add support for PostgreSQL operator classes to add_index · 1dca75c2
      Greg Navis 提交于
      Add support for specifying non-default operator classes in PostgreSQL
      indexes. An example CREATE INDEX query that becomes possible is:
      
          CREATE INDEX users_name ON users USING gist (name gist_trgm_ops);
      
      Previously it was possible to specify the `gist` index but not the
      custom operator class. The `add_index` call for the above query is:
      
          add_index :users, :name, using: :gist, opclasses: {name: :gist_trgm_ops}
      1dca75c2
  4. 25 9月, 2017 1 次提交
  5. 23 9月, 2017 1 次提交
  6. 01 9月, 2017 1 次提交
  7. 20 7月, 2017 1 次提交
  8. 02 7月, 2017 1 次提交
  9. 01 7月, 2017 1 次提交
  10. 19 5月, 2017 1 次提交
  11. 17 4月, 2017 1 次提交
  12. 16 4月, 2017 1 次提交
  13. 04 3月, 2017 1 次提交
    • R
      Don't share `options` with a reference type column · 465357ae
      Ryuta Kamizono 提交于
      Sharing `options` causes some unexpected behavior. If `limit: 2` is
      specified, this means that 2 bytes integer for a reference id column and
      2 chars string for a reference type column. Another example, if
      `unsigned: true` is specified, this means that unsigned integer for a
      reference id column, but a invalid option for a reference type column.
      So `options` should not be shared with a reference type column.
      465357ae
  14. 09 2月, 2017 1 次提交
  15. 07 2月, 2017 1 次提交
  16. 02 2月, 2017 1 次提交
  17. 13 1月, 2017 1 次提交
  18. 23 12月, 2016 1 次提交
  19. 06 12月, 2016 1 次提交
  20. 20 10月, 2016 1 次提交
  21. 18 8月, 2016 1 次提交
    • T
      Added nil case handling to allow rollback migration in case of · 906ff07e
      travis.h.oneill@gmail.com 提交于
      invalid column type
          /activerecord/lib/active_record/connection_adapters
          /abstract/schema_definitions.rb:306
          type = type.to_sym
      
      Changed to the following to handle nil case:
          type = type.to_sym if type
      
      Added regression test for this case:
        /activerecord/test/cases/migration_test.rb:554
        if current_adapter?(:SQLite3Adapter)
          def test_allows_sqlite3_rollback_on_invalid_column_type
            Person.connection.create_table :something, force: true do |t|
              t.column :number, :integer
              t.column :name, :string
              t.column :foo, :bar
            end
            assert Person.connection.column_exists?(:something, :foo)
            assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar }
            assert !Person.connection.column_exists?(:something, :foo)
            assert Person.connection.column_exists?(:something, :name)
            assert Person.connection.column_exists?(:something, :number)
          ensure
            Person.connection.drop_table :something, if_exists: true
          end
        end
      906ff07e
  22. 14 8月, 2016 1 次提交
  23. 07 8月, 2016 3 次提交
  24. 02 8月, 2016 1 次提交
  25. 02 6月, 2016 1 次提交
    • S
      Fix failing tests · 1b8a7b82
      Sean Griffin 提交于
      Currently CI is broken due to 56a61e0c and c4cb6862. This occurred because
      the failures are not present on SQLite which is what I normally run
      locally before pushing.
      
      The optimizations to our YAML size were dropping mutations, as
      `with_type` didn't set the previous value if it'd already been read
      (that method was never really designed to be used with values on
      individual objects, it was previously only used for defaults). I'm
      questioning whether there's a better place to be handling the exclusion
      of the type, but this will fix the failing build.
      
      Additionally, there was a bug in `remove_foreign_key` if you passed it
      an options hash containing `to_table`. This now occurs whenever removing
      a reference, as we always normalize to a hash.
      
      [Sean Griffin & Ryuta Kamizono]
      1b8a7b82
  26. 19 4月, 2016 2 次提交
  27. 16 4月, 2016 1 次提交
  28. 16 2月, 2016 1 次提交
    • G
      Let t.foreign_key use the same `to_table` twice · aedde2a3
      George Millo 提交于
      Previously if you used `t.foreign_key` twice within the same
      `create_table` block using the same `to_table`, all statements except
      the final one would fail silently. For example, the following code:
      
          def change
            create_table :flights do |t|
              t.integer :from_id, index: true, null: false
              t.integer :to_id,   index: true, null: false
      
              t.foreign_key :airports, column: :from_id
              t.foreign_key :airports, column: :to_id
            end
          end
      
      Would only create one foreign key, on the column `from_id`.
      
      This commit allows multiple foreign keys to the same table to be created
      within one `create_table` block.
      aedde2a3
  29. 07 2月, 2016 1 次提交
    • M
      Added numeric helper into migrations. · aa38f7d6
      Mehmet Emin İNAÇ 提交于
      With this addition, you can add a column into the table like:
      
      ```
        create_table(:numeric_types) do |t|
          t.numeric :foo, precision: 10, scale: 2, default: 2.0
        end
      ```
      
      The result of the migration above is same with:
      
      ```
        create_table(:numeric_types) do |t|
          t.decimal :foo, precision: 10, scale: 2, default: 2.0
        end
      ```
      aa38f7d6
  30. 24 1月, 2016 1 次提交
    • P
      Pare back default `index` option for the migration generator · 909818b9
      Prathamesh Sonpatki 提交于
      - Using `references` or `belongs_to` in migrations will always add index
        for the referenced column by default, without adding `index:true` option
        to generated migration file.
      - Users can opt out of this by passing `index: false`.
      - Legacy migrations won't be affected by this change. They will continue
        to run as they were before.
      - Fixes #18146
      909818b9
  31. 15 12月, 2015 2 次提交
    • M
      Use a real migration version number in docs · 97c77160
      Matthew Draper 提交于
      Even though this means more things to change when we bump after a
      release, it's more important that our examples are directly copyable.
      97c77160
    • M
      Use a deliberately-invalid migration version in all doc examples · c0af95e0
      Matthew Draper 提交于
      If we use a real version, at best that'll be an onerous update required
      for each release; at worst, it will encourage users to write new
      migrations against an older version than they're using.
      
      The other option would be to leave these bare, without any version
      specifier. But as that's just a variant spelling of "4.2", it would seem
      to raise the same concerns as above.
      c0af95e0
  32. 08 11月, 2015 1 次提交
  33. 04 11月, 2015 1 次提交
  34. 21 10月, 2015 2 次提交
    • J
      Extract native getter to attr_reader. · 6f47ea1a
      jbranchaud 提交于
      The getter is doing nothing more than returning the ivar, so it can be
      extracted to an attr_reader.
      6f47ea1a
    • Y
      move documentation of column options to `add_column`. Closes #20400. · 173fc1f7
      Yves Senn 提交于
      [ci skip]
      
      It's been a source of confusion that the lower-level `add_column`
      referenced the higher level `column` method for available options.
      `column` supports additional functionality like `index: true` that is
      not present on `add_column`.
      
      This patch moves common option documentation to `add_column` and only
      documents the additional options in `column`.
      173fc1f7
  35. 14 10月, 2015 1 次提交
    • Y
      applies new doc guidelines to Active Record. · 428d47ad
      Yves Senn 提交于
      The focus of this change is to make the API more accessible.
      References to method and classes should be linked to make it easy to
      navigate around.
      
      This patch makes exzessiv use of `rdoc-ref:` to provide more readable
      docs. This makes it possible to document `ActiveRecord::Base#save` even
      though the method is within a separate module
      `ActiveRecord::Persistence`. The goal here is to bring the API closer to
      the actual code that you would write.
      
      This commit only deals with Active Record. The other gems will be
      updated accordingly but in different commits. The pass through Active
      Record is not completely finished yet. A follow up commit will change
      the spots I haven't yet had the time to update.
      
      /cc @fxn
      428d47ad