aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
Commit message (Collapse)AuthorAgeFilesLines
...
| * Refactor #insert_fixtures to use ArelKir Shatrov2017-06-191-4/+11
| |
* | Merge pull request #29431 from kamipo/fix_create_table_with_query_from_relationMatthew Draper2017-06-171-1/+6
|\ \ | |/ |/| Fix `create_table` with query from relation
| * Fix `create_table` with query from relationRyuta Kamizono2017-06-131-1/+6
| | | | | | | | | | If a relation has binds, `connection.to_sql(relation)` without binds will generate invalid SQL. It should use `relation.to_sql` in that case.
* | Fix `dump_schema_information` with empty versionsRyuta Kamizono2017-06-151-1/+1
|/ | | | Fixes #29460.
* Remove `null_allowed` option from doc [ci skip]yuuji.yaginuma2017-06-101-2/+1
| | | | This option was added in b9fa354. But it does not seem to work.
* [ci skip] Add missing `be`Prathamesh Sonpatki2017-06-031-1/+1
|
* Merge pull request #29135 from ↵Eileen M. Uchitelle2017-06-021-0/+19
|\ | | | | | | | | Nerian/document_support_for_composite_primary_keys Document support for composite primary keys
| * Document support for composite primary keysNerian2017-05-181-0/+19
| |
* | Merge pull request #29145 from kamipo/reference_type_should_be_not_nullMatthew Draper2017-05-241-1/+1
|\ \ | | | | | | Both reference id and type should be `NOT NULL` if `null: false` is specified
| * | Both reference id and type should be `NOT NULL` if `null: false` is specifiedRyuta Kamizono2017-05-191-1/+1
| |/ | | | | | | | | | | This is a regression due to #28282. Fixes #29136.
* / [Foreign Key] Don't worry about the building identifier if name is already ↵Mohit Natoo2017-05-101-2/+3
|/ | | | present.
* Clarify deprecation message for #quoted_idMatthew Draper2017-05-051-1/+8
| | | | | In this case, it's the method definition that's more at fault, rather than the current caller.
* Deprecate `supports_statement_cache?`Ryuta Kamizono2017-05-011-2/+3
| | | | | | | | | | | | | | `supports_statement_cache?` was introduced in 3.1.0.beta1 (104d0b2) for bind parameter substitution, but it is no longer used in 3.1.0.rc1 (73ff679). Originally it should respect `prepared_statements` rather than `supports_statement_cache?` (fd39847). One more thing, named `supports_statement_cache?` is pretty misreading. We have `StatementCache` and `StatementPool`. However, `supports_statement_cache?` doesn't mean `StatementCache`, but `StatementPool` unlike its name. https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/statement_cache.rb https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/connection_adapters/statement_pool.rb
* Lock connection before checking it inMatthew Draper2017-04-261-6/+8
|
* Fix typos [ci skip]Tobias Fankhänel2017-04-251-2/+2
| | | | | | | | | 'lookup' is the noun. 'to look up' is the verb. Looked it up just to be sure. cf. https://en.wiktionary.org/wiki/lookup https://en.wiktionary.org/wiki/look_up
* Fix the doc on the `IndexDefinition` [ci skip]Ryuta Kamizono2017-04-171-1/+1
| | | | Since 1a92ae83 all `indexes` methods are under the `SchemaStatements`.
* Refactor `indexes` things in connection adaptersRyuta Kamizono2017-04-161-1/+26
| | | | | | | * Use keyword arguments in `IndexDefinition` to ease to ignore unused options and to avoid to initialize incorrect empty value. * Place it in `SchemaStatements` for consistency. * And tiny tweaks.
* Add comprehensive locking around DB transactionsMatthew Draper2017-04-111-39/+49
| | | | | | | | | | | | | | | | | | Transactional-fixture using tests with racing threads and inter-thread synchronisation inside transaction blocks will now deadlock... but without this, they would just crash. In 5.0, the threads didn't share a connection at all, so it would've worked... but with the main thread inside the fixture transaction, they wouldn't've been able to see each other. So: as far as I can tell, the set of operations this "breaks" never had a compelling use case. Meanwhile, it provides an increased level of coherency to the operational feel of transactional fixtures. If this does cause anyone problems, they're probably best off disabling transactional fixtures on the affected tests, and managing transactions themselves.
* Fix example usage of ActiveRecord::Base.establish_connectionSimon Dawson2017-03-301-1/+1
| | | `ActiveRecord::Base.establish_connection` accepts a single symbol argument to specify a named connection; a single string argument appears to be interpreted as a connection URI
* Make internal methods to privateRyuta Kamizono2017-03-273-34/+51
|
* Fix `LogSubscriber` to allow legacy `binds`Ryuta Kamizono2017-03-231-8/+7
| | | | Follow up of #27939.
* Merge pull request #28487 from kamipo/remove_duplicated_columns_definitionRafael França2017-03-201-3/+5
|\ | | | | Remove duplicated `columns` definition
| * Remove duplicated `columns` definitionRyuta Kamizono2017-03-201-3/+5
| |
* | Merge pull request #27939 from kamipo/fix_select_all_with_legacy_bindsRafael França2017-03-201-1/+5
|\ \ | |/ |/| Fix `select_all` with legacy `binds`
| * Fix `select_all` with legacy `binds`Ryuta Kamizono2017-02-121-1/+5
| | | | | | | | Fixes #27923.
* | Merge pull request #28068 from kamipo/refactor_data_sourcesRafael França2017-03-131-2/+18
|\ \ | | | | | | Extract `data_source_sql` to refactor data source statements
| * | Extract `data_source_sql` to refactor data source statementsRyuta Kamizono2017-02-201-2/+18
| | |
* | | Extract `SchemaMigration.all_versions`Ryuta Kamizono2017-03-061-2/+2
| | | | | | | | | | | | | | | Use `SchemaMigration.all_versions` instead of `SchemaMigration.all.map(&:version)` to avoid to instantiate AR objects.
* | | Remove useless `Migrator.schema_migrations_table_name`Ryuta Kamizono2017-03-051-2/+2
| | | | | | | | | | | | Simply use `SchemaMigration.table_name` instead.
* | | Don't hide method that's been documented API since Rails 2.1Andrew White2017-03-041-3/+3
| | |
* | | Fix `rake db:schema:load` with subdirectoriesRyuta Kamizono2017-03-051-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | Related #25174. `db:schema:load` doesn't work with subdirectories like previous `db:migrate:status`. `Migrator.migration_files` should be used in `assume_migrated_upto_version` to fix the issue.
* | | Don't share `options` with a reference type columnRyuta Kamizono2017-03-041-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Sharing `options` causes some unexpected behavior. If `limit: 2` is specified, this means that 2 bytes integer for a reference id column and 2 chars string for a reference type column. Another example, if `unsigned: true` is specified, this means that unsigned integer for a reference id column, but a invalid option for a reference type column. So `options` should not be shared with a reference type column.
* | | `create_join_table` should respect `references` column typeRyuta Kamizono2017-02-281-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | Follow up of #26266. The default type of `primary_key` and `references` were changed to `bigint` since #26266. But `create_join_table` column type is still `integer`. It should respect `references` column type.
* | | Merge pull request #25285 from ↵Rafael França2017-02-231-0/+1
|\ \ \ | | | | | | | | | | | | | | | | kamipo/fix_remove_reference_to_multiple_foreign_keys_in_the_same_table Fix `remove_reference` to multiple foreign keys in the same table
| * | | Fix `remove_reference` to multiple foreign keys in the same tableRyuta Kamizono2017-02-111-0/+1
| | |/ | |/|
* | | Deprecate using `#quoted_id` in quotingRyuta Kamizono2017-02-241-0/+2
| | | | | | | | | | | | | | | Originally `quoted_id` was used in legacy quoting mechanism. Now we use type casting mechanism for that. Let's deprecate `quoted_id`.
* | | Fix type casting AR object to respect the primary key cast type's serializationRyuta Kamizono2017-02-241-2/+13
| | |
* | | Correctly dump native timestamp types for MySQLRyuta Kamizono2017-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The native timestamp type in MySQL is different from datetime type. Internal representation of the timestamp type is UNIX time, This means that timestamp columns are affected by time zone. ``` > SET time_zone = '+00:00'; Query OK, 0 rows affected (0.00 sec) > INSERT INTO time_with_zone(ts,dt) VALUES (NOW(),NOW()); Query OK, 1 row affected (0.02 sec) > SELECT * FROM time_with_zone; +---------------------+---------------------+ | ts | dt | +---------------------+---------------------+ | 2016-02-07 22:11:44 | 2016-02-07 22:11:44 | +---------------------+---------------------+ 1 row in set (0.00 sec) > SET time_zone = '-08:00'; Query OK, 0 rows affected (0.00 sec) > SELECT * FROM time_with_zone; +---------------------+---------------------+ | ts | dt | +---------------------+---------------------+ | 2016-02-07 14:11:44 | 2016-02-07 22:11:44 | +---------------------+---------------------+ 1 row in set (0.00 sec) ```
* | | Ensure test threads share a DB connectioneileencodes2017-02-202-17/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures multiple threads inside a transactional test to see consistent database state. When a system test starts Puma spins up one thread and Capybara spins up another thread. Because of this when tests are run the database cannot see what was inserted into the database on teardown. This is because there are two threads using two different connections. This change uses the statement cache to lock the threads to using a single connection ID instead of each not being able to see each other. This code only runs in the fixture setup and teardown so it does not affect real production databases. When a transaction is opened we set `lock_thread` to `Thread.current` so we can keep track of which connection the thread is using. When we rollback the transaction we unlock the thread and then there will be no left-over data in the database because the transaction will roll back the correct connections. [ Eileen M. Uchitelle, Matthew Draper ]
* | | Improve `create_table force: true`Ryuta Kamizono2017-02-201-2/+2
| |/ |/| | | | | | | Extra `data_source_exists?(table_name)` is unneeded if `drop_table(table_name, if_exists: true)` directly.
* | Merge pull request #26655 from kamipo/fix_remove_expression_indexRafael França2017-02-131-12/+16
|\ \ | | | | | | Fix `remove_index` to be able to remove expression indexes
| * | Fix `remove_index` to be able to remove expression indexesRyuta Kamizono2016-12-251-12/+16
| | | | | | | | | | | | Fixes #26635, #26641.
* | | Merge pull request #26930 from kamipo/index_name_exists_defaultRafael França2017-02-131-6/+7
|\ \ \ | | | | | | | | The `default` arg of `index_name_exists?` makes to optional
| * | | Deprecate passing `default` to `index_name_exists?`Ryuta Kamizono2017-02-131-0/+5
| | | |
| * | | The `default` arg of `index_name_exists?` makes to optionalRyuta Kamizono2017-02-131-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | The `default` arg of `index_name_exists?` is only used the adapter does not implemented `indexes`. But currently all adapters implemented `indexes` (See #26688). Therefore the `default` arg is never used.
* | | | Merge pull request #26630 from kamipo/quoted_binaryRafael França2017-02-131-1/+6
|\ \ \ \ | |/ / / |/| | | Extract `quoted_binary` and use it rather than override `_quote`
| * | | Extract `quoted_binary` and use it rather than override `_quote`Ryuta Kamizono2016-09-271-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Each databases have different binary representation. Therefore all adapters overrides `_quote` for quoting binary. Extract `quoted_binary` for quoting binary and use it rather than override `_quote`.
* | | | Schema dumping support for PostgreSQL interval typeRyuta Kamizono2017-02-121-1/+1
| |_|/ |/| | | | | | | | Closes #27979
* | | Refactor `ColumnDefinition` to contain `options` hashRyuta Kamizono2017-02-093-34/+23
| | | | | | | | | | | | | | | | | | Column options are passed as an hash args then used as `options` hash in `add_column_options!`. Converting args to attributes is inconvinient for using options as an hash.
* | | `primary_key` and `references` columns should be identical typeRyuta Kamizono2017-02-072-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | Follow up to #26266. The default type of `primary_key` and `references` were changed to `bigint` since #26266. But legacy migration and sqlite3 adapter should keep its previous behavior.