1. 10 2月, 2017 1 次提交
    • J
      Simplify and speed up Postgres query for primary_keys · d6529af2
      Jordan Lewis 提交于
      primary_keys(table) needs to query various metadata tables in Postgres to
      determine the primary key for the table. Previously, it did so using a
      complex common table expression against pg_constraint and pg_attribute.
      
      This patch simplifies the query by joining pg_index against pg_attribute
      instead of going through pg_constraint. This avoids an expensive unnest,
      window function query, and common table expression.
      
      EXPLAINing these queries in Postgres against a database with a single
      table with a composite primary key shows a 66% reduction in the plan and
      execute latencies. This is significant during application startup time,
      especially against very large schemas, where these queries would be even
      slower and more numerous.
      
      Closes #27949
      d6529af2
  2. 09 2月, 2017 1 次提交
  3. 04 1月, 2017 1 次提交
  4. 30 12月, 2016 2 次提交
  5. 12 11月, 2016 1 次提交
  6. 14 10月, 2016 1 次提交
  7. 11 10月, 2016 1 次提交
    • R
      Fix table comment dumping · 0780c444
      Ryuta Kamizono 提交于
      Follow up to #26735.
      
      If `table_options` returns `{ comment: nil }`, `create_table` line is
      broken.
      
      Example:
      
      ```ruby
        create_table "accounts", force: :cascade,  do |t|
      ```
      0780c444
  8. 06 9月, 2016 1 次提交
  9. 02 9月, 2016 1 次提交
  10. 16 8月, 2016 1 次提交
  11. 07 8月, 2016 3 次提交
  12. 18 7月, 2016 1 次提交
    • B
      Refactored method... · 6bb46ae2
      bogdanvlviv 提交于
      Refactored method `ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`
      6bb46ae2
  13. 14 6月, 2016 1 次提交
  14. 10 6月, 2016 1 次提交
  15. 07 6月, 2016 1 次提交
  16. 30 4月, 2016 1 次提交
  17. 25 4月, 2016 1 次提交
  18. 20 4月, 2016 1 次提交
  19. 19 4月, 2016 1 次提交
  20. 16 4月, 2016 1 次提交
  21. 12 4月, 2016 1 次提交
  22. 08 3月, 2016 2 次提交
  23. 04 3月, 2016 1 次提交
  24. 18 12月, 2015 1 次提交
  25. 17 12月, 2015 1 次提交
    • G
      Support passing the schema name prefix to `conenction.indexes` · d927f35b
      Grey Baker 提交于
      Support passing the schema name as a prefix to table name in
      `ConnectionAdapters::SchemaStatements#indexes`. Previously the prefix would
      be considered a full part of the index name, and only the schema in the
      current search path would be considered.
      d927f35b
  26. 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
  27. 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
  28. 20 9月, 2015 1 次提交
  29. 13 9月, 2015 1 次提交
  30. 06 9月, 2015 2 次提交
  31. 28 8月, 2015 3 次提交
  32. 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
  33. 20 5月, 2015 1 次提交