aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #20175 from eugeneius/copy_schema_cache_after_forkRafael Mendonça França2015-05-181-1/+3
|\ | | | | Add schema cache to new connection pool after fork
| * Add schema cache to new connection pool after forkEugene Kenny2015-05-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Active Record detects when the process has forked and automatically creates a new connection pool to avoid sharing file descriptors. If the existing connection pool had a schema cache associated with it, the new pool should copy it to avoid unnecessarily querying the database for its schema. The code to detect that the process has forked is in ConnectionHandler, but the existing test for it was in the ConnectionManagement test file. I moved it to the right place while I was writing the new test for this change.
* | Merge pull request #20192 from kamipo/divide_to_column_options_handling_methodsRafael Mendonça França2015-05-182-10/+34
|\ \ | | | | | | Divide methods for handling column options separately
| * | Divide methods for handling column options separatelyRyuta Kamizono2015-05-182-10/+34
| |/
* | Merge pull request #20190 from kamipo/fix_serial_with_quoted_sequence_nameRafael Mendonça França2015-05-181-1/+2
|\ \ | | | | | | Fix `serial?` with quoted sequence name
| * | Fix `serial?` with quoted sequence nameRyuta Kamizono2015-05-181-1/+2
| |/
* / better `add_reference` documentation. [ci skip]Yves Senn2015-05-182-20/+18
|/ | | | | | | | | This patch - reduces the duplication among the `reference`-family methods. - better explains all the optians available for `add_reference`. - redirects to user from `references` to `add_reference`. Originated by #20184.
* Merge pull request #14938 from thedarkone/pool-lock-fixMatthew Draper2015-05-162-85/+406
|\ | | | | Reducing AR::ConPool's critical (synchronized) section
| * AR::ConPool - remove synchronization around connection cache.thedarkone2015-05-141-79/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renamed `@reserved_connections` -> `@thread_cached_conns`. New name clearly conveys the purpose of the cache, which is to speed-up `#connection` method. The new `@thread_cached_conns` now also uses `Thread` objects as keys (instead of previously `Thread.current.object_id`). Since there is no longer any synchronization around `@thread_cached_conns`, `disconnect!` and `clear_reloadable_connections!` methods now pre-emptively obtain ownership (via `checkout`) of all existing connections, before modifying internal data structures. A private method `release` has been renamed `thread_conn_uncache` to clear-up its purpose. Fixed some brittle `thread.status == "sleep"` tests (threads can go into sleep even without locks).
| * AR::ConPool - establish connections outside of critical section.thedarkone2015-05-141-27/+101
| |
| * AR::ConPool - reduce post checkout critical section.thedarkone2015-05-142-13/+35
| | | | | | | | Move post checkout connection verification out of mutex.synchronize.
* | Remove redundant require 'set' linesMehmet Emin İNAÇ2015-05-152-2/+0
|/
* :nodoc: postgresql add_columnTony Miller2015-05-131-3/+1
|
* Refactor abstract_mysql_adapter type_to_sql methodMehmet Emin İNAÇ2015-05-131-21/+33
|
* :nodoc: rename_column in postgresql/schema_statements.rbTony Miller2015-05-081-1/+1
| | | | | Its already doc'ed in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
* Merge pull request #20047 from mcfiredrill/make-subquery-for-privateRafael Mendonça França2015-05-061-13/+13
|\ | | | | make AbstractAdapter#subquery_for private
| * make AbstractAdapter#subquery_for privateTony Miller2015-05-061-13/+13
| |
* | Merge pull request #20025 from kamipo/dont_use_exec_query_for_performanceMatthew Draper2015-05-052-22/+17
|\ \ | | | | | | Use `select_value` for avoid `ActiveRecord::Result` instance creating
| * | Use `select_value` for avoid `ActiveRecord::Result` instance creatingRyuta Kamizono2015-05-052-22/+17
| | | | | | | | | | | | | | | `exec_query` create `ActiveRecord::Result` instance. It is better to use `select_value` instead of `exec_query` for performance.
* | | Merge pull request #20024 from ↵Matthew Draper2015-05-051-2/+3
|\ \ \ | | | | | | | | | | | | | | | | kamipo/use_select_rows_instead_of_select_one_in_select_values Use `select_rows` instead of `select_one` in `select_value`
| * | | Use `select_rows` instead of `select_one` in `select_value`Ryuta Kamizono2015-05-051-2/+3
| |/ / | | | | | | | | | | | | `select_one` create `ActiveRecord::Result` instance. It is better to use `select_rows` instead of `select_one` for performance.
* | | Merge pull request #17632 from eugeneius/schema_cache_dump_connection_poolAaron Patterson2015-05-042-2/+12
|\ \ \ | |/ / |/| | Apply schema cache dump when creating connections
| * | Apply schema cache dump when creating connectionsEugene Kenny2015-04-292-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `db:schema:cache:dump` rake task dumps the database schema structure to `db/schema_cache.dump`. If this file is present, the schema details are loaded into the currently checked out connection by a railtie while Rails is booting, to avoid having to query the database for its schema. The schema cache dump is only applied to the initial connection used to boot the application though; other connections from the same pool are created with an empty schema cache, and still have to load the structure of each table directly from the database. With this change, a copy of the schema cache is associated with the connection pool and applied to connections as they are created.
* | | More exercise the create index sql testsRyuta Kamizono2015-05-042-4/+5
| | |
* | | Do not use options that does not supportRyuta Kamizono2015-05-041-4/+4
| | | | | | | | | | | | | | | MySQL does not support partial index. And, the create index algorithm in create table can not be specified.
* | | Merge pull request #17569 from kamipo/dump_table_optionsRafael Mendonça França2015-05-032-0/+14
|\ \ \ | | | | | | | | | | | | Correctly dump `:options` on `create_table` for MySQL
| * | | Correctly dump `:options` on `create_table` for MySQLRyuta Kamizono2015-05-032-0/+14
| | | |
* | | | Merge pull request #19978 from kamipo/collation_option_support_for_postgresqlRafael Mendonça França2015-05-038-32/+52
|\ \ \ \ | | | | | | | | | | PostgreSQL: `:collation` support for string and text columns
| * | | | PostgreSQL: `:collation` support for string and text columnsRyuta Kamizono2015-05-042-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: create_table :foos do |t| t.string :string_en, collation: 'en_US.UTF-8' t.text :text_ja, collation: 'ja_JP.UTF-8' end
| * | | | Move the collation handling code from the MySQL adapter to common classesRyuta Kamizono2015-05-047-29/+37
| | | | | | | | | | | | | | | | | | | | | | | | | Some databases like MySQL allow defining collation charset for specific columns.
* | | | | Merge pull request #19989 from kamipo/change_visit_addcolumn_visibiltyRafael Mendonça França2015-05-033-11/+14
|\ \ \ \ \ | | | | | | | | | | | | Change the `visit_AddColumn` visiblity for the internal API
| * | | | | Change the `visit_AddColumn` visiblity for the internal APIRyuta Kamizono2015-05-033-11/+14
| | | | | |
* | | | | | Missing `:bigint` [ci skip]Ryuta Kamizono2015-05-041-1/+1
| |/ / / / |/| | | |
* | | | | Merge pull request #19988 from kamipo/move_comment_about_microsecondsZachary Scott2015-05-032-2/+3
|\ \ \ \ \ | |_|_|_|/ |/| | | | Move comment about microseconds [ci skip]
| * | | | Move comment about microseconds [ci skip]Ryuta Kamizono2015-05-032-2/+3
| |/ / / | | | | | | | | | | | | The microseconds handling was already moved to `Quoting#quoted_date`.
* | | | gem 'mysql2', '~> 0.3.18'Ryuta Kamizono2015-05-041-1/+1
| | | | | | | | | | | | | | | | Follow up #18914.
* | | | `:nodoc:` postgresql's change_columnTony Miller2015-05-031-2/+1
|/ / / | | | | | | | | | | | | Its nodoc'ed for the other implementations, and doc'ed in the base class, just like the other change_column* methods.
* / / :nodoc: change_column_null in the implmenting adaptersTony Miller2015-05-033-3/+3
|/ / | | | | | | | | | | `change_column_null` is doc'ed only in ActiveRecord::ConnectionAdapters::SchemaStatements, so it would make sense to :nodoc: it elsewhere.
* | Merge pull request #19962 from prathamesh-sonpatki/nodoc-validate-index-lengthYves Senn2015-04-301-1/+1
|\ \ | | | | | | Nodoc validate_index_length! method
| * | Nodoc validate_index_length! methodPrathamesh Sonpatki2015-04-301-1/+1
| |/ | | | | | | - This method is used only by adapters to validate length of new index names.
* / Added documentation for PostGreSQL database_statements [ci skip]Prathamesh Sonpatki2015-04-302-2/+5
|/ | | | | | - Added documentation for index_name_exists? and rename_index. - Also changed rails to \Rails in documentation of allowed_index_name_length.
* Don't document internal monkey patch for mysql gem [ci skip]Zachary Scott2015-04-261-1/+3
| | | | Also added reference for to_date, as it belongs historically.
* use a more descriptive example. [ci skip]Yves Senn2015-04-241-6/+4
| | | | follow up to 107526e809ea2b6de8b2775ecf83e55d60833206
* docs for `create_table` and non-int primary keys. [ci skip]Yves Senn2015-04-241-0/+17
|
* Fix missing index when using timestamps with indexPaul Mucur2015-04-151-0/+1
| | | | | | | | | | | The `index` option used with `timestamps` should be passed to both `column` definitions for `created_at` and `updated_at` rather than just the first. This was happening because `Hash#delete` is used to extract the `index` option passed to `timestamps`, thereby mutating the `options` hash in-place. Now take a copy of the `options` before deleting so that the original is not modified.
* Document that partial indexes are only supported by Postgres and SQLite.Grey Baker2015-04-131-0/+2
| | | | Fixes #18106
* Add a note regarding add_column restricted API [ci skip]Zachary Scott2015-04-121-0/+4
| | | | | | We should document current behavior, and this is design of API for now. Closes #17597
* fix documentation for SchemaStatements#add_foreign_keySimon Stemplinger2015-04-081-2/+2
| | | | | | The implementation of the generation of the foreign key name was changed between Rails 4.2.0 and 4.2.1 from a random to a deterministic behavior, however the documentation still describes the old randomized behavior.
* Merge pull request #17574 from kamipo/charset_collation_optionsJeremy Kemper2015-04-072-0/+39
|\ | | | | | | Add charset and collation options support for MySQL string and text columns.
| * Add `:charset` and `:collation` options support for MySQL string and text ↵Ryuta Kamizono2015-03-062-0/+39
| | | | | | | | | | | | | | | | | | | | | | columns Example: create_table :foos do |t| t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin' t.text :text_ascii, charset: 'ascii' end