aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
Commit message (Collapse)AuthorAgeFilesLines
* Distribute connections to previously blocked threads when we're doneMatthew Draper2016-11-251-19/+17
| | | | | | Two methods block new connections; we were already doing the right thing for clear_reloadable_connections, but it's better placed in with_new_connections_blocked, where it can work for disconnect too.
* Merge pull request #27057 from kamipo/fix_race_conditionMatthew Draper2016-11-191-6/+7
|\ | | | | | | Fix the race condition caused by `with_new_connections_blocked`
| * Fix the race condition caused by `with_new_connections_blocked`Ryuta Kamizono2016-11-181-8/+4
|/ | | | | | `with_new_connections_blocked` was introduced at #14938. But the method sometimes causes `@new_cons_enabled = false` then never toggled to true.
* Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-133-8/+8
|\ | | | | Add missing `+` around a some literals.
| * Add missing `+` around a some literals.bogdanvlviv2016-10-273-8/+8
| | | | | | | | | | | | Mainly around `nil` [ci skip]
* | Merge pull request #26978 from matthewd/query-cache-poolMatthew Draper2016-11-102-0/+28
|\ \ | | | | | | Configure query caching (per thread) on the connection pool
| * | Configure query caching (per thread) on the connection poolMatthew Draper2016-11-062-0/+28
| | |
* | | Add ActiveRecord::Base.connection_pool.statPavel2016-11-091-0/+18
|/ /
* | Merge pull request #26909 from matthewd/query-cache-connectionMatthew Draper2016-11-061-0/+2
|\ \ | | | | | | Clear query cache during checkin, instead of an execution callback
| * | Clear query cache during checkin, instead of an execution callbackMatthew Draper2016-10-271-0/+2
| |/ | | | | | | | | | | | | It doesn't make sense for the query cache to persist while a connection moves through the pool and is assigned to a new thread. [Samuel Cochran & Matthew Draper]
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-293-3/+3
| |
* | Merge pull request #26688 from kamipo/remove_respond_to_indexesKasper Timm Hansen2016-10-281-4/+0
|\ \ | | | | | | Remove unnecessary `respond_to?(:indexes)` checking
| * | Remove unnecessary `respond_to?(:indexes)` checkingRyuta Kamizono2016-10-031-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently all adapters (postgresql, mysql2, sqlite3, oracle-enhanced, and sqlserver) implemented `indexes` and schema dumper expects implemented `indexes`. https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/schema_dumper.rb#L208 Therefore `respond_to?(:indexes)` checking is unnecessary.
* | | Use Regexp#match? rather than Regexp#===Ryuta Kamizono2016-10-261-1/+1
| |/ |/| | | | | Follow up to 99cf7558000090668b137085bfe6bcc06c4571dc.
* | Fix indentation of code examplesOrhan Toy2016-10-191-4/+4
| | | | | | | | This commit fixes the generated HTML of the two code examples.
* | Extract `format_colspec` to format column specRyuta Kamizono2016-10-111-3/+1
| |
* | `name` is not a column optionRyuta Kamizono2016-10-102-3/+2
| | | | | | | | `migration_keys` includes `name` but `name` is not a column option.
* | Dump index options to pretty formatRyuta Kamizono2016-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | ```ruby # Before t.index ["firm_id", "type", "rating"], name: "company_index", order: {"rating"=>:desc}, using: :btree # After t.index ["firm_id", "type", "rating"], name: "company_index", order: { rating: :desc }, using: :btree ```
* | Prevent to create blank commentRyuta Kamizono2016-10-081-2/+2
|/ | | | | Currently blank comment does not dump to `db/schema.rb`. But created it even if specified blank.
* Preserve cached queries name in AS notificationsJean Boussier2016-09-221-4/+10
|
* Force correct namespace when using TransactionManagerArthur Neves2016-09-161-1/+1
| | | | [fixes #26441]
* fix typo in `add_column` doc [ci skip]yuuji.yaginuma2016-09-161-1/+1
|
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-142-44/+44
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-011-2/+2
|
* Merge pull request #26217 from kamipo/revert_23067Rafael França2016-08-191-1/+1
|\ | | | | Revert "`sql_for_insert` returns values for passing to `exec_insert`"
| * Revert "`sql_for_insert` returns values for passing to `exec_insert`"Ryuta Kamizono2016-08-191-1/+1
| | | | | | | | | | | | | | This reverts #23067. #23067 is for propagating `pk` value from `sql_for_insert` to `exec_insert` (avoiding extra query for pg adapter). Now `exec_insert` includes `sql_for_insert` since #26002 therefore this propagating is no longer needed.
* | Added nil case handling to allow rollback migration in case oftravis.h.oneill@gmail.com2016-08-172-2/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | invalid column type /activerecord/lib/active_record/connection_adapters /abstract/schema_definitions.rb:306 type = type.to_sym Changed to the following to handle nil case: type = type.to_sym if type Added regression test for this case: /activerecord/test/cases/migration_test.rb:554 if current_adapter?(:SQLite3Adapter) def test_allows_sqlite3_rollback_on_invalid_column_type Person.connection.create_table :something, force: true do |t| t.column :number, :integer t.column :name, :string t.column :foo, :bar end assert Person.connection.column_exists?(:something, :foo) assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar } assert !Person.connection.column_exists?(:something, :foo) assert Person.connection.column_exists?(:something, :name) assert Person.connection.column_exists?(:something, :number) ensure Person.connection.drop_table :something, if_exists: true end end
* Merge pull request #26002 from ↵Rafael França2016-08-171-2/+2
|\ | | | | | | | | kamipo/sql_for_insert_should_be_called_inside_exec_insert `sql_for_insert` should be called inside `exec_insert`
| * `sql_for_insert` should be called inside `exec_insert`Ryuta Kamizono2016-08-061-2/+2
| | | | | | | | | | `exec_insert` cannot return last inserted id if `use_insert_returning?` is true. `sql_for_insert` should be called inside `exec_insert`.
* | Add array column documentationoss922016-08-161-0/+4
| |
* | Merge pull request #26151 from kamipo/avoid_to_allow_unused_splat_argsRafael França2016-08-161-3/+1
|\ \ | | | | | | Avoid to allow unused splat args for `t.timestamps` in `create_table`
| * | Avoid to allow unused splat args for `t.timestamps` in `create_table`Ryuta Kamizono2016-08-141-3/+1
| | | | | | | | | | | | | | | | | | Unfortunately `t.timestamps` in `create_table` allows unused splat args. But the same one in `change_table` does not allow them. This commit fixes the inconsistent behavior.
* | | Merge pull request #26155 from kamipo/refactor_quoted_columns_for_indexRafael Mendonça França2016-08-161-13/+16
|\ \ \ | | | | | | | | | | | | Refactor `quoted_columns_for_index` by extracted `add_options_for_index_columns`
| * | | Refactor `quoted_columns_for_index` by extracted `add_options_for_index_columns`Ryuta Kamizono2016-08-141-13/+16
| |/ /
* | | Merge pull request #26019 from agrobbin/schema-load-unique-column-indicesRafael França2016-08-162-3/+3
|\ \ \ | | | | | | | | Support multiple indexes on the same column when loading the schema
| * | | support multiple indexes on the same column when loading the schemaAlex Robbin2016-08-022-3/+3
| | | |
* | | | Add three new rubocop rulesRafael Mendonça França2016-08-163-13/+13
| |/ / |/| | | | | | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | | Fix a NoMethodError schema_statements.rbGenadi Samokovarov2016-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you call `remove_index` with wrong options, say a type, like I did, you get: ``` == 20160810072541 RemoveUniqueIndexOnGoals: migrating ========================= -- remove_index(:goal, {:coulmn=>:kid_id, :unique=>true}) rails aborted! StandardError: An error has occurred, this and all later migrations canceled: undefined method `ArgumentError' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x007fb7dec91b28> ``` What happened is that I mistyped column (coulmn) and got a `NoMethodError`, because of a missing comma during the raise. This made Ruby think we're calling the method `ArgumentError`.
* | | applies remaining conventions across the projectXavier Noria2016-08-063-7/+0
| | |
* | | normalizes indentation and whitespace across the projectXavier Noria2016-08-066-338/+338
| | |
* | | modernizes hash syntax in activerecordXavier Noria2016-08-063-5/+5
| | |
* | | applies new string literal convention in activerecord/libXavier Noria2016-08-068-31/+31
| |/ |/| | | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* | Make `name` and `binds` to optional args for `exec_{insert,update,delete}`Ryuta Kamizono2016-08-041-3/+3
| | | | | | | | | | | | `insert`, `update`, `delete`, and `exec_query` have a default value against `name` and `binds`. But `exec_insert`, `exec_update`, and `exec_delete` not have. It is an inconvenience and inconsistent.
* | Remove extra connection pool creationArthur Neves2016-08-021-1/+0
| |
* | Merge branch 'master' of github.com:rails/docrailsVijay Dev2016-08-021-1/+1
|\ \ | |/ |/|
| * Fix documentation of `index` option for the `add_reference` method [ci skip]Prathamesh Sonpatki2016-07-161-1/+1
| | | | | | | | - Followup of https://github.com/rails/rails/pull/23179.
* | Remove `prepare_binds_for_database` internal methodRyuta Kamizono2016-07-282-5/+1
| | | | | | | | To avoid relying on the connection adapter for type casting binds.
* | Merge pull request #25938 from ↵Rafael França2016-07-271-3/+4
|\ \ | | | | | | | | | | | | kamipo/decouple_statement_cache_from_connection_adapter Decouple statement cache from connection adapter
| * | Decouple statement cache from connection adapterRyuta Kamizono2016-07-241-3/+4
| | | | | | | | | | | | | | | | | | `StatementCache` is hard-coded in `cacheable_query` and be passed `visitor` and `collector` from connection adapter. Simply it is enough to pass a collected value.
* | | Merge pull request #25408 from kamipo/should_not_reuse_quoted_trueYves Senn2016-07-271-4/+4
|\ \ \ | | | | | | | | Quoting booleans should return a frozen string