1. 08 12月, 2017 1 次提交
    • R
      SQLite: Fix `copy_table` with composite primary keys · 131cc6ea
      Ryuta Kamizono 提交于
      `connection.primary_key` also return composite primary keys, so
      `from_primary_key_column` may not be found even if `from_primary_key` is
      presented.
      
      ```
      % ARCONN=sqlite3 be ruby -w -Itest
      test/cases/adapters/sqlite3/sqlite3_adapter_test.rb -n
      test_copy_table_with_composite_primary_keys
      Using sqlite3
      Run options: -n test_copy_table_with_composite_primary_keys --seed 19041
      
      # Running:
      
      E
      
      Error:
      ActiveRecord::ConnectionAdapters::SQLite3AdapterTest#test_copy_table_with_composite_primary_keys:
      NoMethodError: undefined method `type' for nil:NilClass
          /path/to/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:411:in
          `block in copy_table'
      ```
      
      This change fixes `copy_table` to do not lose composite primary keys.
      131cc6ea
  2. 07 12月, 2017 1 次提交
    • A
      Fix sqlite migrations with custom primary keys · 5ac4f4d2
      Ashley Ellis Pierce 提交于
      Previously, if a record was created with a custom primary key, that
      table could not be migrated using sqlite. While attempting to copy the
      table, the type of the primary key was ignored.
      
      Once that was corrected, copying the indexes would fail because custom
      primary keys are autoindexed by sqlite by default.
      
      To correct that, this skips copying the index if the index name begins
      with "sqlite_". This is a reserved word that indicates that the
      index is an internal schema object. SQLite prohibits applications from
      creating objects whose names begin with "sqlite_", so this string should
      be safe to use as a check.
      ref https://www.sqlite.org/fileformat2.html#intschema
      5ac4f4d2
  3. 03 12月, 2017 2 次提交
  4. 30 11月, 2017 1 次提交
  5. 21 10月, 2017 1 次提交
  6. 27 8月, 2017 1 次提交
  7. 22 8月, 2017 2 次提交
  8. 20 8月, 2017 1 次提交
  9. 18 8月, 2017 1 次提交
  10. 24 7月, 2017 1 次提交
    • S
      Refactor Active Record to let Arel manage bind params · 213796fb
      Sean Griffin 提交于
      A common source of bugs and code bloat within Active Record has been the
      need for us to maintain the list of bind values separately from the AST
      they're associated with. This makes any sort of AST manipulation
      incredibly difficult, as any time we want to potentially insert or
      remove an AST node, we need to traverse the entire tree to find where
      the associated bind parameters are.
      
      With this change, the bind parameters now live on the AST directly.
      Active Record does not need to know or care about them until the final
      AST traversal for SQL construction. Rather than returning just the SQL,
      the Arel collector will now return both the SQL and the bind parameters.
      At this point the connection adapter will have all the values that it
      had before.
      
      A bit of this code is janky and something I'd like to refactor later. In
      particular, I don't like how we're handling associations in the
      predicate builder, the special casing of `StatementCache::Substitute` in
      `QueryAttribute`, or generally how we're handling bind value replacement
      in the statement cache when prepared statements are disabled.
      
      This also mostly reverts #26378, as it moved all the code into a
      location that I wanted to delete.
      
      /cc @metaskills @yahonda, this change will affect the adapters
      
      Fixes #29766.
      Fixes #29804.
      Fixes #26541.
      Close #28539.
      Close #24769.
      Close #26468.
      Close #26202.
      
      There are probably other issues/PRs that can be closed because of this
      commit, but that's all I could find on the first few pages.
      213796fb
  11. 20 7月, 2017 1 次提交
  12. 16 7月, 2017 1 次提交
  13. 13 7月, 2017 1 次提交
  14. 12 7月, 2017 1 次提交
    • L
      Change sqlite3 boolean serialization to use 1 and 0 · 52e050ed
      Lisa Ugray 提交于
      Abstract boolean serialization has been using 't' and 'f', with MySQL
      overriding that to use 1 and 0.
      
      This has the advantage that SQLite natively recognizes 1 and 0 as true
      and false, but does not natively recognize 't' and 'f'.
      
      This change in serialization requires a migration of stored boolean data
      for SQLite databases, so it's implemented behind a configuration flag
      whose default false value is deprecated. The flag itself can be
      deprecated in a future version of Rails.  While loaded models will give
      the correct result for boolean columns without migrating old data,
      where() clauses will interact incorrectly with old data.
      
      While working in this area, also change the abstract adapter to use
      `"TRUE"` and `"FALSE"` as quoted values and `true` and `false` for
      unquoted.  These are supported by PostreSQL, and MySQL remains
      overriden.
      52e050ed
  15. 02 7月, 2017 1 次提交
  16. 01 7月, 2017 2 次提交
  17. 30 6月, 2017 1 次提交
    • R
      Don't cache queries for schema statements · 21d040f9
      Ryuta Kamizono 提交于
      `test_middleware_caches` is sometimes failed since #29454.
      The failure is due to schema statements are affected by query caching.
      Bypassing query caching for schema statements to avoid the issue.
      21d040f9
  18. 21 6月, 2017 1 次提交
    • K
      Use bulk INSERT to insert fixtures · 4ee42379
      Kir Shatrov 提交于
      Improves the performance from O(n) to O(1).
      Previously it would require 50 queries to
      insert 50 fixtures. Now it takes only one query.
      
      Disabled on sqlite which doesn't support multiple inserts.
      4ee42379
  19. 01 5月, 2017 1 次提交
  20. 16 4月, 2017 1 次提交
  21. 26 3月, 2017 1 次提交
  22. 28 2月, 2017 1 次提交
  23. 27 2月, 2017 1 次提交
  24. 26 2月, 2017 2 次提交
  25. 20 2月, 2017 1 次提交
  26. 13 2月, 2017 1 次提交
    • R
      Deprecate `supports_primary_key?` · bb45fa05
      Ryuta Kamizono 提交于
      `supports_primary_key?` was added to determine if `primary_key` is
      implemented in the adapter in f0602214. But we already use `primary_key`
      without `supports_primary_key?` (207f266c, 5f3cf424) and using
      `supports_primary_key?` has been removed in #1318. This means that
      `supports_primary_key?` is no longer used in the internal and Active
      Record doesn't work without `primary_key` is implemented (all adapters
      must implement `primary_key`).
      
      Closes #27977
      bb45fa05
  27. 07 2月, 2017 1 次提交
  28. 17 1月, 2017 1 次提交
  29. 16 1月, 2017 1 次提交
  30. 04 1月, 2017 1 次提交
  31. 30 12月, 2016 2 次提交
  32. 29 12月, 2016 1 次提交
  33. 24 12月, 2016 1 次提交
  34. 06 12月, 2016 2 次提交