aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Skip test that use fork in the memory store dbRafael Mendonça França2018-01-241-32/+34
|
* Make discard safe when it follows a manual disconnectMatthew Draper2018-01-251-0/+40
| | | | | | It doesn't have to do anything, but it shouldn't fail. Fixes #31766.
* Don't update counter cache when through record was not destroyedEugene Kenny2018-01-141-4/+4
| | | | | | When removing a record from a has many through association, the counter cache was being updated even if the through record halted the callback chain and prevented itself from being destroyed.
* Revert commit 4ec5b0d6b4d8a57e034b1014942356e95caf47aa in favor of #28379Ryuta Kamizono2018-01-071-3/+3
| | | | | Commit 4ec5b0d was for fixing the regression #18787, but #28379 fixes #18787 as well. So 4ec5b0d is no longer necessary.
* Don't pass `object_id` to `refute_nil` since `object_id` never to be nilRyuta Kamizono2017-12-261-6/+6
| | | | And prefer `assert_same` over `assert_equal`.
* Improve AR connection fork safetyMatthew Draper2017-11-181-0/+32
| | | | | | Use whatever adapter-provided means we have available to ensure forked children don't send quit/shutdown/goodbye messages to the server on connections that belonged to their parent.
* Merge remote-tracking branch 'origin/master' into unlock-minitestRafael Mendonça França2017-08-017-4/+18
|\
| * Merge pull request #29869 from kamipo/make_type_map_to_privateRafael França2017-07-212-4/+4
| |\ | | | | | | Make `type_map` to private because it is only used in the connection adapter
| | * Make `type_map` to private because it is only used in the connection adapterRyuta Kamizono2017-07-202-4/+4
| | | | | | | | | | | | | | | | | | | | | `type_map` is an internal API and it is only used in the connection adapter. And also, some type map initializer methods requires passed `type_map`, but those instances already has `type_map` in itself. So we don't need explicit passing `type_map` to the initializers.
| * | Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-197-0/+14
| |/
| * Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-027-7/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * Enforce frozen string in RubocopKir Shatrov2017-07-017-0/+7
| |
* | Add teardown to reset_connection at MysqlTypeLookupTestYasuo Honda2017-06-071-0/+7
|/ | | | | to address `Mysql2BooleanTest#test_column_type_without_emulated_booleans` failure
* `DEFAULT_ENV` falls back to `default_env` when `RAILS_ENV` or `RACK_ENV` is ↵Ryuta Kamizono2017-05-251-0/+11
| | | | | | an empty string Follow up of #27399.
* Allow 3-level DB configs to group connections by environmentMatthew Draper2017-02-221-0/+60
| | | | [Arthur Nogueira Neves & Matthew Draper]
* Fix a test of AR::Type::TypeMap#lookup when using OracleKoichi ITO2017-02-021-6/+14
|
* Fix pool_from_any_process to use most recent speceileencodes2017-01-131-0/+35
| | | | | | | | | | | | | If a process is forked more than once, the pool was grabbing the oldest spec, not the most recent spec. This wasn't noticed before because most folks are lilely forking the process only once. If you're forking the process multiple times however the wrong spec name will be returned and an incorrect connection will be used for the process. This fixes the issue by reversing the list of spec names so we can grab the most recent spec rather than the oldest spec.
* `#tables` and `#table_exists?` and returns only tables and not viewsRafael Mendonça França2016-12-291-4/+7
|
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-25/+25
|
* Use YAML to serialize schema cacheKir Shatrov2016-11-271-4/+39
|
* Move `test_quoting_classes` into `test/cases/quoting_test.rb`Ryuta Kamizono2016-10-291-13/+0
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-292-10/+10
|
* Add three new rubocop rulesRafael Mendonça França2016-08-162-3/+3
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-062-136/+136
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-066-103/+103
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Add to_hash to specificationArthur Neves2016-05-251-1/+1
|
* Remove `name` from `establish_connection`Arthur Neves2016-05-242-8/+7
| | | | | Instead of passing a separete name variable, we can make the resolver merge a name on the config, and use that before creating the Specification.
* remove_connection should not remove parent connectionArthur Neves2016-05-111-0/+7
| | | | | | When calling remove_connection in a subclass, that should not fallback to the parent, otherwise it will remove the parent connection from the handler.
* Dont cache the conn_spec_name when emptyArthur Neves2016-05-111-1/+10
| | | | | | | | We cannot cache the connection_specification_name when it doesnt exist. Thats because the parent value could change, and we should keep failling back to the parent. If we cache that in a children as an ivar, we would not fallback anymore in the next call, so the children would not get the new parent spec_name.
* Make sure we reset the connection_specification_name onArthur Neves2016-05-101-0/+14
| | | | | | | | | | | | | | remove_connection When calling `remove_connection` on a model, we delete the pool so we also need to reset the `connection_specification_name` so it will fallback to the parent. This was the current behavior before rails 5, which will fallback to the parent connection pool. [fixes #24959] Special thanks to @jrafanie for working with me on this fix.
* s/specification_id/specification_nameArthur Neves2016-05-051-7/+7
|
* Use spec key, when given as spec_idArthur Neves2016-05-051-19/+15
|
* Refactor connection handlerArthur Neves2016-05-053-23/+25
| | | | | | | | | | | | | | | ConnectionHandler will not have any knowlodge of AR models now, it will only know about the specs. Like that we can decouple the two, and allow the same model to use more than one connection. Historically, folks used to create abstract AR classes on the fly in order to have multiple connections for the same model, and override the connection methods. With this, now we can override the `specificiation_id` method in the model, to return a key, that will be used to find the connection_pool from the handler.
* Fix some typos in comments.Joe Rafaniello2016-05-041-1/+1
| | | | [ci skip]
* Remove legacy mysql adapterAbdelkader Boudih2015-12-171-1/+1
|
* introduce `conn.data_source_exists?` and `conn.data_sources`.Yves Senn2015-09-221-3/+8
| | | | | | | | | | | | | | | | | 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)
* Fix the MySQL column type `SET` registration bugTaishi Kasuga2015-06-201-0/+4
|
* Map :bigint as NUMBER(19) sql_type by using `:limit => 19` for OracleYasuo Honda2015-06-011-1/+5
| | | | | | | | | | | | | | | | | | | since NUMBER(8) is not enough to store the maximum number of bigint. Oracle NUMBER(p,0) as handled as integer because there is no dedicated integer sql data type exist in Oracle database. Also NUMBER(p,s) precision can take up to 38. p means the number of digits, not the byte length. bigint type needs 19 digits as follows. $ irb 2.2.2 :001 > limit = 8 => 8 2.2.2 :002 > maxvalue_of_bigint = 1 << ( limit * 8 - 1) => 9223372036854775808 2.2.2 :003 > puts maxvalue_of_bigint.to_s.length 19 => nil 2.2.2 :004 >
* Add schema cache to new connection pool after forkEugene Kenny2015-05-171-0/+46
| | | | | | | | | | | | | | 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.
* AR::ConPool - establish connections outside of critical section.thedarkone2015-05-141-1/+1
|
* AR::ConPool - reduce post checkout critical section.thedarkone2015-05-141-1/+3
| | | | Move post checkout connection verification out of mutex.synchronize.
* Revert "Merge pull request #19404 from dmathieu/remove_rack_env"Jeremy Kemper2015-03-201-0/+34
| | | | | | | Preserving RACK_ENV behavior. This reverts commit 7bdc7635b885e473f6a577264fd8efad1c02174f, reversing changes made to 45786be516e13d55a1fca9a4abaddd5781209103.
* don't fallback to RACK_ENV when RAILS_ENV is not presentDamien Mathieu2015-03-191-34/+0
|
* `type_cast_from_user` -> `cast`Sean Griffin2015-02-171-1/+1
|
* Properly lookup the limit for bigintSean Griffin2015-02-021-0/+5
| | | | Fixes #18787.
* Remove deprecated access to connection specification using a string acessor.Rafael Mendonça França2015-01-041-38/+0
| | | | Now all strings will be handled as a URL.
* Return an array of pools from `connection_pools`Rafael Mendonça França2015-01-041-3/+1
|
* Merge pull request #17305 from ↵Rafael Mendonça França2014-10-311-0/+89
|\ | | | | | | | | ziggythehamster/activerecord-connectionhandling-RAILS_ENV-without-rails If Rails is not defined, check ENV["RAILS_ENV"] and ENV["RACK_ENV"] in ActiveRecord::ConnectionHandling
| * If Rails is not defined, check ENV["RAILS_ENV"] and ENV["RACK_ENV"].Keith Gable2014-10-211-0/+89
| | | | | | | | | | | | | | This fixes a regression introduced by 6cc03675d30b58e28f585720dad14e947a57ff5b. ActiveRecord, if used without Rails, always checks the "default_env" environment. This would be OK, except that Sinatra also supports environments, and it runs with {RACK|RAILS}_ENV=production. This patch adds a fallback to RAILS_ENV and RACK_ENV (and ultimately default_env) if Rails.env doesn't exist.