1. 21 12月, 2015 2 次提交
  2. 17 12月, 2015 2 次提交
  3. 16 12月, 2015 2 次提交
  4. 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
  5. 01 12月, 2015 1 次提交
    • D
      Explain the connection pool error message better · b83c097a
      Dmytrii Nagirniak 提交于
      The previous message was misleading (especially for Ops guys) when
      diagnosing problems related to the database connection.
      
      The message was suggesting that the connection cannot be obtained which
      normally assumes the need to look at the database.
      
      But this isn't the case as the connection could not be retrieved from
      the application's internal connection pool.
      
      The new message should make it more explicit and remove the confusion.
      b83c097a
  6. 09 11月, 2015 1 次提交
    • Y
      Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes` · 7429633b
      yui-knk 提交于
      Reported on #21509, how views is treated by `#tables` are differ
      by each adapters. To fix this different behavior, after Rails 5.0
      is released, deprecate `#tables`.
      
      And `#table_exists?` would check both tables and views.
      To make their behavior consistent with `#tables`, after Rails 5.0
      is released, deprecate `#table_exists?`.
      7429633b
  7. 08 11月, 2015 1 次提交
  8. 07 11月, 2015 1 次提交
  9. 05 11月, 2015 1 次提交
  10. 04 11月, 2015 1 次提交
  11. 21 10月, 2015 3 次提交
    • 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
    • S
      Do not cache prepared statements that are unlikely to have cache hits · cbcdecd2
      Sean Griffin 提交于
      Prior to this commit, Rails makes no differentiation between whether a
      query uses bind parameters, and whether or not we cache that query as a
      prepared statement. This leads to the cache populating extremely fast in
      some cases, with the statements never being reused.
      
      In particular, the two problematic cases are `where(foo: [1, 2, 3])` and
      `where("foo = ?", 1)`. In both cases we'll end up quoting the values
      rather than using a bind param, causing a cache entry for every value
      ever used in that query.
      
      It was noted that we can probably eventually change `where("foo = ?",
      1)` to use a bind param, which would resolve that case. Additionally, on
      PG we can change our generated query to be `WHERE foo = ANY($1)`, and
      pass an array for the bind param. I hope to accomplish both in the
      future.
      
      For SQLite and MySQL, we still end up preparing the statements anyway,
      we just don't cache it. The statement will be cleaned up after it is
      executed. On postgres, we skip the prepare step entirely, as an API is
      provided to execute with bind params without preparing the statement.
      
      I'm not 100% happy on the way this ended up being structured. I was
      hoping to use a decorator on the visitor, rather than mixing a module
      into the object, but the way Arel has it's visitor pattern set up makes
      it very difficult to extend without inheritance. I'd like to remove the
      duplication from the various places that are extending it, but that'll
      require a larger restructuring of that initialization logic. I'm going
      to take another look at the structure of it soon.
      
      This changes the signature of one of the adapter's internals, and will
      require downstream changes from third party adapters. I'm not too
      worried about this, as worst case they can simply add the parameter and
      always ignore it, and just keep their previous behavior.
      
      Fixes #21992.
      cbcdecd2
  12. 14 10月, 2015 2 次提交
    • 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
    • Y
      fix RDoc markup in `ConnectionPool`. [ci skip] · 809fd2b2
      Yves Senn 提交于
      809fd2b2
  13. 13 10月, 2015 2 次提交
  14. 28 9月, 2015 1 次提交
  15. 27 9月, 2015 1 次提交
  16. 23 9月, 2015 1 次提交
    • Y
      introduce `conn.data_source_exists?` and `conn.data_sources`. · 152b85f0
      Yves Senn 提交于
      These new methods are used from the Active Record model layer to
      determine which relations are viable to back a model. These new methods
      allow us to change `conn.tables` in the future to only return tables and
      no views. Same for `conn.table_exists?`.
      
      The goal is to provide the following introspection methods on the
      connection:
      
      * `tables`
      * `table_exists?`
      * `views`
      * `view_exists?`
      * `data_sources` (views + tables)
      * `data_source_exists?` (views + tables)
      152b85f0
  17. 21 9月, 2015 1 次提交
    • J
      Add title for key lengths for multiple keys. · 5df94c6f
      Joshua Pinter 提交于
      Previously there was no separator between the two code examples so it looked like: 
      
      ```ruby
      CREATE INDEX by_name ON accounts(name(10))
      add_index(:accounts, [:name, :surname], name: 'by_name_surname', length: {name: 10, surname: 15})
      ```
      5df94c6f
  18. 20 9月, 2015 2 次提交
    • R
      Support for foreign keys in create table · fdf371ab
      Ryuta Kamizono 提交于
      If foreign keys specified in create table, generated SQL is slightly more
      efficient.
      
      Definition:
      
          ```
          create_table :testings do |t|
            t.references :testing_parent, foreign_key: true
          end
          ```
      
      Before:
      
          ```
          CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer);
          ALTER TABLE "testings" ADD CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id");
          ```
      
      After:
      
          ```
          CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer, CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id"));
          ```
      fdf371ab
    • R
      Correctly dump composite primary key · ab128599
      Ryuta Kamizono 提交于
      Example:
      
          create_table :barcodes, primary_key: ["region", "code"] do |t|
            t.string :region
            t.integer :code
          end
      ab128599
  19. 19 9月, 2015 1 次提交
  20. 17 9月, 2015 2 次提交
  21. 16 9月, 2015 3 次提交
  22. 14 9月, 2015 1 次提交
  23. 13 9月, 2015 2 次提交
  24. 10 9月, 2015 1 次提交
  25. 09 9月, 2015 1 次提交
  26. 08 9月, 2015 1 次提交
    • Y
      Define `SchemaStatements#tables` as interface · 1fbd954e
      yui-knk 提交于
      These 3 methods expect `ConnectionAdapters` to have `tables` method,
      so make it clear that `tables` method is interface.
      
      * `ConnectionAdapters::SchemaCache#prepare_tables`
      * `db:schema:cache:dump` task
      * `SchemaDumper#tables`
      1fbd954e
  27. 06 9月, 2015 1 次提交