1. 01 2月, 2016 1 次提交
  2. 08 1月, 2016 1 次提交
  3. 07 1月, 2016 2 次提交
  4. 05 1月, 2016 1 次提交
  5. 01 12月, 2015 1 次提交
  6. 30 11月, 2015 1 次提交
  7. 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
  8. 03 11月, 2015 1 次提交
  9. 22 10月, 2015 1 次提交
    • R
      Remove `#tables` extra args again · edfb738b
      Ryuta Kamizono 提交于
      This issue was resolved by #21687 already. But re-add args by #18856.
      `#tables` extra args was only using by `#table_exists?`. This is for
      internal API. This commit will remove these extra args again.
      edfb738b
  10. 21 10月, 2015 1 次提交
    • 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
  11. 04 10月, 2015 1 次提交
  12. 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
  13. 20 9月, 2015 2 次提交
  14. 13 9月, 2015 1 次提交
  15. 06 9月, 2015 1 次提交
  16. 21 7月, 2015 1 次提交
  17. 27 6月, 2015 1 次提交
    • P
      Add reversible syntax for change_column_default · a4128725
      Prem Sichanugrist 提交于
      Passing `:from` and `:to` to `change_column_default` makes this command
      reversible as user has defined its previous state.
      
      So, instead of having the migration command as:
      
          change_column_default(:posts, :state, "draft")
      
      They can write it as:
      
          change_column_default(:posts, :state, from: nil, to: "draft")
      a4128725
  18. 28 5月, 2015 1 次提交
  19. 20 5月, 2015 2 次提交
  20. 03 5月, 2015 1 次提交
  21. 25 2月, 2015 1 次提交
  22. 12 2月, 2015 1 次提交
    • S
      Remove the SQLite3 Binary subclass · c9cc1f47
      Sean Griffin 提交于
      As far as I can tell, the original reason that this behavior was added
      has been sufficiently resolved elsewhere, as we no longer remove the
      encoding of strings coming out of the database.
      c9cc1f47
  23. 07 2月, 2015 1 次提交
    • S
      Allow a symbol to be passed to `attribute`, in place of a type object · 101c19f5
      Sean Griffin 提交于
      The same is not true of `define_attribute`, which is meant to be the low
      level no-magic API that sits underneath. The differences between the two
      APIs are:
      
      - `attribute`
        - Lazy (the attribute will be defined after the schema has loaded)
        - Allows either a type object or a symbol
      - `define_attribute`
        - Runs immediately (might get trampled by schema loading)
        - Requires a type object
      
      This was the last blocker in terms of public interface requirements
      originally discussed for this feature back in May. All the
      implementation blockers have been cleared, so this feature is probably
      ready for release (pending one more look-over by me).
      101c19f5
  24. 04 2月, 2015 1 次提交
    • S
      rm `Column#cast_type` · 158c7eb1
      Sean Griffin 提交于
      The type from the column is never used, except when being passed to the
      attributes API. While leaving the type on the column wasn't necessarily
      a bad thing, I worry that it's existence there implies that it is
      something which should be used.
      
      During the design and implementation process of the attributes API,
      there have been plenty of cases where getting the "right" type object
      was hard, but I had easy access to the column objects. For any
      contributor who isn't intimately familiar with the intents behind the
      type casting system, grabbing the type from the column might easily seem
      like the "correct" thing to do.
      
      As such, the goal of this change is to express that the column is not
      something that should be used for type casting. The only places that are
      "valid" (at the time of this commit) uses of acquiring a type object
      from the column are fixtures (as the YAML file is going to mirror the
      database more closely than the AR object), and looking up the type
      during schema detection to pass to the attributes API
      
      Many of the failing tests were removed, as they've been made obsolete
      over the last year. All of the PG column tests were testing nothing
      beyond polymorphism. The Mysql2 tests were duplicating the mysql tests,
      since they now share a column class.
      
      The implementation is a little hairy, and slightly verbose, but it felt
      preferable to going back to 20 constructor options for the columns. If
      you are git blaming to figure out wtf I was thinking with them, and have
      a better idea, go for it. Just don't use a type object for this.
      158c7eb1
  25. 29 1月, 2015 1 次提交
  26. 28 1月, 2015 1 次提交
    • S
      Remove Relation#bind_params · b06f64c3
      Sean Griffin 提交于
      `bound_attributes` is now used universally across the board, removing
      the need for the conversion layer. These changes are mostly mechanical,
      with the exception of the log subscriber. Additional, we had to
      implement `hash` on the attribute objects, so they could be used as a
      key for query caching.
      b06f64c3
  27. 24 1月, 2015 1 次提交
  28. 02 1月, 2015 1 次提交
  29. 31 12月, 2014 1 次提交
  30. 11 12月, 2014 1 次提交
  31. 01 12月, 2014 1 次提交
  32. 29 11月, 2014 1 次提交
  33. 25 11月, 2014 1 次提交
  34. 11 11月, 2014 1 次提交
  35. 03 11月, 2014 1 次提交
  36. 21 10月, 2014 1 次提交
    • C
      Remove duplicate 'select' database statement · ec981aa1
      claudiob 提交于
      The `select` method has the same definition in almost all database
      adapters, so it can be moved from the database-specific adapters
      (PostgreSQl, MySQL, SQLite) to the abstract `database_statement`:
      
      ```ruby
      def select(sql, name = nil, binds = [])
        exec_query(sql, name, binds)
      end
      ```
      
      ---
      
      More details about this commit: the only two DB-specific adapters
      that have a different definition of `select` are MySQLAdapter and
      MySQL2Adapter.
      
      In MySQLAdapter, `select` invokes `exec_query(sql, name, binds)`, so
      calling `super` achieves the same goal with less repetition.
      
      In MySQL2Adapter, `select` invokes `exec_query(sql, name)`, that is,
      it does not pass the `binds` parameter like other methods do. However,
      [MySQL2Adapter's `exec_query`](https://github.com/rails/rails/blob/74a527cc63ef56f3d0a42cf638299958dc7cb08c/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L228L231)
      works exactly the same whether this parameters is passed or not, so the output
      does not change:
      
      ```ruby
      def exec_query(sql, name = 'SQL', binds = [])
        result = execute(sql, name)
        ActiveRecord::Result.new(result.fields, result.to_a)
      end
      ```
      ec981aa1
  37. 09 9月, 2014 1 次提交