aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't default to YAML dumping when quoting valuesSean Griffin2015-01-142-3/+8
| | | | | | | This behavior exists only to support fixtures, so we should handle it there. Leaving it in `#quote` can cause very subtle bugs to slip through, by things appearing to work when they should be blowing up loudly, such as #18385.
* Merge pull request #18478 from ↵Sean Griffin2015-01-131-1/+2
|\ | | | | | | | | yoshiokatsuneo/active_record_connection_pool_error_disconnect ActiveRecord: On reconnection failure, release only failed connetion.
| * ActiveRecord: On reconnection failure, release only failed connetion.Yoshioka Tsuneo2015-01-131-1/+2
| | | | | | | | | | | | | | On reconnection failure, all the connection was released. But, it is better to release only failed connection. This patch changes not to release all the connection but release only failed connection.
* | Deprecate passing a column to `quote`Sean Griffin2015-01-101-0/+6
| | | | | | | | | | It's only used to grab the type for type casting purposes, and we would like to remove the type from the columns entirely.
* | Stop passing a column to `quote` when prepared statements are turned offSean Griffin2015-01-101-3/+3
| | | | | | | | | | | | | | I'm planning on deprecating the column argument to mirror the deprecation in [arel]. [arel]: https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
* | Stop passing a column to `quote` in `insert_fixture`Sean Griffin2015-01-102-4/+14
| | | | | | | | | | | | | | I'm planning on deprecating the column argument to mirror the deprecation in [arel]. [arel]: https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
* | Copy records to parent transaction should happen on TransactionManagerArthur Neves2015-01-091-3/+3
| | | | | | | | It is up to the TransactionManager keep the state of current transaction, so after it commits it needs to copy any remaning record to the next current transaction
* | Use keyword args on committed! and rolledback!Arthur Neves2015-01-091-3/+3
|/ | | | As discussed before, those methods should receive a keyword args instead of just parameters
* ActiveRecord: release connection on reconnect failure.Yoshioka Tsuneo2015-01-091-0/+3
| | | | | | | | | | | | | | | | | | When trying to checkout connection from connection pool, checkout()(and checkout_and_verify) verify whether the connection is active or not. And, if the connection is not active, connection adapters try to reconnect to server. And, if database is down at this moment, reconnect fails and exception is raised. (Ex: Mysql2::Error: Can't connect to local MySQL server through socket xxx) But, ConnectionPool does not catch the exception, but leaks current disconnected connection to @connection. So, if database's temporary down happens several times and exceeds the number of connection pool(5 by default), activerecord will be no more available, even if database server is already recovered. This patch fix it by catching exception and releasing connection.
* Change transaction callbacks to not swallowing errors.Rafael Mendonça França2015-01-041-12/+2
| | | | | | | | Before this change any error raised inside a transaction callback are rescued and printed in the logs. Now these errors are not rescue anymore and just bubble up, as the other callbacks.
* Change the default `null` value for `timestamps` to `false`Rafael Mendonça França2015-01-042-17/+5
|
* Return an array of pools from `connection_pools`Rafael Mendonça França2015-01-041-10/+1
|
* `sql_type` has been determined already when quoting defaultsRyuta Kamizono2015-01-041-4/+2
| | | | No need to call `type_to_sql` again.
* Refactor `visit_ChangeColumnDefinition`Ryuta Kamizono2015-01-031-1/+1
| | | | `visit_ChangeColumnDefinition` is the same "CHANGE column_name " + `visit_ColumnDefinition(o)`.
* Add default value for `create_table_definition`Ryuta Kamizono2015-01-031-2/+2
| | | | | In most cases, `create_table_definition` called by table_name (the first argument) only.
* Merge pull request #17820 from fw42/restore_query_cache_on_rollbackRafael Mendonça França2015-01-023-3/+14
|\ | | | | | | Clear query cache on rollback
| * Restore query cache on rollbackFlorian Weingarten2014-12-013-3/+14
| |
* | Merge pull request #18228 from kamipo/correctly_dump_primary_keyRafael Mendonça França2015-01-021-0/+6
|\ \ | | | | | | | | | | | | | | | | | | Improve a dump of the primary key support. Conflicts: activerecord/CHANGELOG.md
| * | Improve a dump of the primary key support.Ryuta Kamizono2014-12-291-0/+6
| | | | | | | | | | | | If it is not a default primary key, correctly dump the type and options.
* | | Merge pull request #18080 from korbin/fix_reaping_frequency_configurationRafael Mendonça França2015-01-021-1/+1
|\ \ \ | | | | | | | | | | | | Fix issue with reaping_frequency type.
| * | | fix issue with reaping_frequency typekorbin2014-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using DATABASE_URL to configure ActiveRecord, :reaping_frequency does not get converted from a string to a numeric value. This value is eventually passed to 'sleep' and must be numeric to avoid exceptions. This commit converts :reaping_frequency to a float when present.
* | | | 💣 I forgot to commit the arity changeSean Griffin2015-01-011-1/+1
| | | |
* | | | Stop passing the column to the connection adapter when quoting defaultsSean Griffin2015-01-011-2/+2
| | | | | | | | | | | | | | | | | | | | The column is no longer used for anything besides type casting, which is what we're trying to remove from the column entirely.
* | | | Extract the index length validation to a auxiliar methodRafael Mendonça França2014-12-301-3/+8
| |/ / |/| |
* | | Minor documentation edits [ci skip]Robin Dupret2014-12-281-6/+5
| | |
* | | Add bigint primary key support for MySQL.Ryuta Kamizono2014-12-282-1/+3
| | | | | | | | | | | | | | | | | | | | | Example: create_table :foos, id: :bigint do |t| end
* | | Support for any type primary key.Ryuta Kamizono2014-12-281-1/+5
| | |
* | | reduce duplication in `ConnectionAdapters::Table` docs. [ci skip]Yves Senn2014-12-271-27/+38
| | | | | | | | | | | | | | | | | | Most of the documentation very closely mirrors the matching docs from `SchemaStatements`. I reduced duplicated copy and added links to the underlying methods for the user to follow.
* | | Refactor a common class to reduce the duplication for `references`Sean Griffin2014-12-232-59/+86
| | | | | | | | | | | | | | | | | | | | | | | | The code for `TableDefinition#references` and `SchemaStatements#add_reference` were almost identical both structurally, and in terms of domain knowledge. This removes that duplication into a common class, using the `Table` API as the expected interface of its collaborator.
* | | Fix connection leak when a thread checks in additional connections.Matt Jones2014-12-231-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code in `ConnectionPool#release` assumed that a single thread only ever holds a single connection, and thus that releasing a connection only requires the owning thread_id. There is a trivial counterexample to this assumption: code that checks out additional connections from the pool in the same thread. For instance: connection_1 = ActiveRecord::Base.connection connection_2 = ActiveRecord::Base.connection_pool.checkout ActiveRecord::Base.connection_pool.checkin(connection_2) connection_3 = ActiveRecord::Base.connection At this point, connection_1 has been removed from the `@reserved_connections` hash, causing a NEW connection to be returned as connection_3 and the loss of any tracking info on connection_1. As long as the thread in this example lives, connection_1 will be inaccessible and un-reapable. If this block of code runs more times than the size of the connection pool in a single thread, every subsequent connection attempt will timeout, as all of the available connections have been leaked. Reverts parts of 9e457a8654fa89fe329719f88ae3679aefb21e56 and essentially all of 4367d2f05cbeda855820e25a08353d4b7b3457ac
* | | Add `foreign_key` as an option to `references` for `change_table`Sean Griffin2014-12-222-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has the same comments as 9af90ffa00ba35bdee888e3e1ab775ba0bdbe72c, however it affects the `add_reference` method, and `t.references` in the context of a `change_table` block. There is a lot of duplication of code between creating and updating tables. We should re-evaluate the structure of this code from a high level so changes like this don't need to be made in two places. (Note to self)
* | | Convert `add_references` to use kwargsSean Griffin2014-12-221-6/+18
| | | | | | | | | | | | | | | | | | While we still aren't accepting PRs that only make changes like this, it's fine when we're actively working on a method if it makes our lives easier.
* | | Add a `foreign_key` option to `references` while creating the tableSean Griffin2014-12-222-5/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than having to do: create_table :posts do |t| t.references :user end add_foreign_key :posts, :users You can instead do: create_table :posts do |t| t.references :user, foreign_key: true end Similar to the `index` option, you can also pass a hash. This will be passed as the options to `add_foreign_key`. e.g.: create_table :posts do |t| t.references :user, foreign_key: { primary_key: :other_id } end is equivalent to create_table :posts do |t| t.references :user end add_foreign_key :posts, :users, primary_key: :other_id
* | | Convert `references` to kwargsSean Griffin2014-12-221-7/+17
| | | | | | | | | | | | | | | | | | While we aren't taking PRs with these kinds of changes just yet, they are fine if we're actively working on the method and it makes things easier.
* | | `force: :cascade` to recreate tables referenced by foreign-keys.Yves Senn2014-12-191-2/+7
|/ /
* | minor sentences fixesNeeraj Singh2014-12-071-3/+3
| |
* | Failure to rollback t.timestamps when within a change_table migrationnoam2014-12-032-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | When running the following migration: change_table(:table_name) { |t| t/timestamps } The following error was produced: wrong number of arguments (2 for 1) .... /connection_adapters/abstract/schema_statements.rb:851:in `remove_timestamps' This is due to `arguments` containing an empty hash as its second argument.
* | no need to pass native_database_types aroundYves Senn2014-12-021-4/+4
| |
* | Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-292-4/+2
| |
* | Merge pull request #17799 from kamipo/refactor_add_column_optionsRafael Mendonça França2014-11-281-2/+2
|\ \ | | | | | | Refactor `add_column_options!`, to move the quoting of default value for :uuid in `quote_value`.
| * | Rename to `quote_default_expression` from `quote_value`Ryuta Kamizono2014-11-281-2/+2
| |/
* / Refactor `SchemaCreation#visit_AddColumn`Ryuta Kamizono2014-11-271-3/+1
|/
* raise a better exception for renaming long indexesAaron Patterson2014-11-201-0/+3
|
* synchronize code and docs for `timestamps` and `add_timestamps`.Yves Senn2014-11-202-8/+10
| | | | | | | | This makes the following changes: * warn if `:null` is not passed to `add_timestamps` * `timestamps` method docs link to `add_timestamps` docs * explain where additional options go * adjust examples to include `null: false` (to prevent deprecation warnings)
* Support symbol foreign key to deletedtaniwaki2014-11-191-1/+1
|
* Merge pull request #17580 from ccutrer/change_table_nameYves Senn2014-11-111-17/+19
|\ | | | | | | add a Table#name accessor like TableDefinition#name
| * add a Table#name accessor like TableDefinition#nameCody Cutrer2014-11-101-17/+19
| |
* | remove never called method `limited_update_conditions`Andrey Deryabin2014-11-111-4/+0
|/
* docs, the abstract data type `:timestamp` was removed. See #15184 [ci skip]Yves Senn2014-11-071-2/+2
|
* Remove redundant `to_s` in interpolationclaudiob2014-10-302-2/+2
|