aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* `sql_for_insert` returns values for passing to `exec_insert`Ryuta Kamizono2016-01-152-22/+14
|
* `substitute_at` is no longer usedRyuta Kamizono2016-01-141-6/+0
| | | | Arel handles substitution for bind parameters by now.
* fix regression when loading fixture files with symbol keys.Yves Senn2016-01-131-2/+3
| | | | Closes #22584.
* Extract `MySQL::TypeMetadata` class to ↵Ryuta Kamizono2016-01-112-28/+34
| | | | `connection_adapters/mysql/type_metadata.rb`
* Extract `MySQL::Column` class to `connection_adapters/mysql/column.rb`Ryuta Kamizono2016-01-112-46/+52
|
* Refactor tz aware types, add support for PG rangesSean Griffin2016-01-082-1/+12
| | | | | | | | | | | | | | | | | This is an alternate implementation to #22875, that generalizes a lot of the logic that type decorators are going to need, in order to have them work with arrays, ranges, etc. The types have the ability to map over a value, with the default implementation being to just yield that given value. Array and Range give more appropriate definitions. This does not automatically make ranges time zone aware, as they need to be added to the `time_zone_aware` types config, but we could certainly make that change if we feel it is appropriate. I do think this would be a breaking change however, and should at least have a deprecation cycle. Closes #22875. /cc @matthewd
* Merge pull request #22967 from schneems/schneems/generic-metadataSean Griffin2016-01-082-0/+5
|\ | | | | Prevent destructive action on production database
| * [ci skip] Add comment to remove silenced code.schneems2016-01-071-0/+1
| |
| * Prevent destructive action on production databaseschneems2016-01-071-0/+4
| | | | | | | | | | | | | | This PR introduces a key/value type store to Active Record that can be used for storing internal values. It is an alternative implementation to #21237 cc @sgrif @matthewd. It is possible to run your tests against your production database by accident right now. While infrequently, but as an anecdotal data point, Heroku receives a non-trivial number of requests for a database restore due to this happening. In these cases the loss can be large. To prevent against running tests against production we can store the "environment" version that was used when migrating the database in a new internal table. Before executing tests we can see if the database is a listed in `protected_environments` and abort. There is a manual escape valve to force this check from happening with environment variable `DISABLE_DATABASE_ENVIRONMENT_CHECK=1`.
* | Merge pull request #22973 from kamipo/fix_select_values_method_signatureRafael França2016-01-082-4/+4
|\ \ | | | | | | Fix `select_values` method signature for consistency
| * | Fix `select_values` method signature for consistencyRyuta Kamizono2016-01-082-4/+4
| | |
* | | `{update|delete}_sql` are almost the same as `{update|delete}`Ryuta Kamizono2016-01-084-25/+2
|/ / | | | | | | Simply `{update|delete}_sql` aliases to `{update|delete}`.
* | Remove `delete_sql` in sqlite3 adapterRyuta Kamizono2016-01-071-5/+0
| | | | | | | | | | `sql += " WHERE 1=1"` was introduced in 69cb942. But it is not needed. ref https://www.sqlite.org/lang_delete.html
* | Refactor `connection.insert_sql`Ryuta Kamizono2016-01-074-35/+10
| | | | | | | | `connection.insert_sql` is almost the same as `connection.insert`.
* | Merge pull request #22921 from prathamesh-sonpatki/fix-add-referenceRafael França2016-01-061-0/+1
|\ \ | | | | | | Autoload ReferenceDefinition class in abstract adapter so that it can be used by #add_reference in schema_statements
| * | Autoload ReferenceDefinition class in abstract adapter so that it can be ↵Prathamesh Sonpatki2016-01-051-0/+1
| | | | | | | | | | | | | | | | | | used by #add_reference in schema_statements - Fixes #22916.
* | | Merge pull request #21688 from kamipo/add_text_and_blob_shorthand_methodsRafael Mendonça França2016-01-061-0/+24
|\ \ \ | | | | | | | | | | | | Add short-hand methods for text and blob types in MySQL
| * | | Add short-hand methods for text and blob types in MySQLRyuta Kamizono2016-01-051-0/+24
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Pg and Sqlite3, `:text` and `:binary` have variable unlimited length. But in MySQL, these have limited length for each types (ref #21591, #21619). This change adds short-hand methods for each text and blob types. Example: create_table :foos do |t| t.tinyblob :tiny_blob t.mediumblob :medium_blob t.longblob :long_blob t.tinytext :tiny_text t.mediumtext :medium_text t.longtext :long_text end
* | | Merge pull request #22920 from kamipo/fix_connection_createRafael França2016-01-054-6/+1
|\ \ \ | |/ / |/| | Fix `connection#create` in PG adapter
| * | Fix `connection#create` in PG adapterRyuta Kamizono2016-01-054-6/+1
| | | | | | | | | | | | | | | | | | Originally `connection#create` had aliased to `connection#insert` in PG adapter. But it was broken by #7447. Re-alias `create` to `insert` for fixing it.
* | | Merge pull request #22896 from kamipo/fix_unsigned_and_blob_or_text_columnRafael França2016-01-041-3/+3
|\ \ \ | |/ / |/| | Fix `unsigned?` and `blob_or_text_column` for Enum columns in MySQL
| * | Fix `unsigned?` and `blob_or_text_column?` for Enum columns in MySQLRyuta Kamizono2016-01-041-3/+3
| | |
* | | Merge pull request #22821 from shosti/set-null-transactionArthur Nogueira Neves2016-01-041-0/+1
|\ \ \ | |/ / |/| | Allow add_to_transaction with null transaction
| * | Allow add_to_transaction with null transactionEmanuel Evans2015-12-281-0/+1
| | | | | | | | | | | | Fixes https://github.com/rails/rails/issues/22819
* | | Refactor `case_{sensitive|insensitive}_comparison`Ryuta Kamizono2016-01-012-17/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` SELECT 1 AS one FROM "topics" WHERE "topics"."title" = 'abc' LIMIT $1 [["LIMIT", 1]] ``` After: ``` SELECT 1 AS one FROM "topics" WHERE "topics"."title" = $1 LIMIT $2 [["title", "abc"], ["LIMIT", 1]] ```
* | | Merge pull request #22848 from derekprior/dp-postgresql-versionRafael França2015-12-301-5/+5
|\ \ \ | | | | | | | | Make `postgresql_version` public
| * | | Make `postgresql_version` publicDerek Prior2015-12-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful to libraries that want to feature gate based on the version of PostgreSQL the user is connected to. For instance, I want to know if the user is connected to a version of Postgres that supports concurrent materialized view refreshes. I could add that as a method on the adapter as a PR, but rails has no need for this itself. Rails is already using the postgresql_version for its own feature gating and this makes that possible for other libraries.
* | | | Merge pull request #22241 from kamipo/add_columns_for_distinct_for_mysql57Rafael França2015-12-302-5/+23
|\ \ \ \ | | | | | | | | | | Add `columns_for_distinct` for MySQL 5.7 with ONLY_FULL_GROUP_BY
| * | | | Add `columns_for_distinct` for MySQL 5.7 with ONLY_FULL_GROUP_BYRyuta Kamizono2015-12-232-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In MySQL 5.7.5 and up, ONLY_FULL_GROUP_BY affects handling of queries that use DISTINCT and ORDER BY. It requires the ORDER BY columns in the select list for distinct queries, and requires that the ORDER BY include the distinct column. See https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
| * | | | Avoid `distinct` if a subquery has already materializedRyuta Kamizono2015-12-231-3/+5
| | | | | | | | | | | | | | | | | | | | Follow up to #19359 and avoid #22241.
* | | | | Merge pull request #22803 from kamipo/improve_select_one_in_mysql2_adapterRafael França2015-12-301-27/+9
|\ \ \ \ \ | | | | | | | | | | | | Improve `select_one` in `Mysql2Adapter`
| * | | | | Remove outdated commentRyuta Kamizono2015-12-271-28/+0
| | | | | | | | | | | | | | | | | | | | | | | | These `select_*` methods improved already.
| * | | | | Improve `select_one` in `Mysql2Adapter`Ryuta Kamizono2015-12-271-0/+10
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | Avoid instanciate `ActiveRecord::Result` and calling `ActiveRecord::Result#hash_rows` for the performance.
* | | | | Merge pull request #22547 from kamipo/fix_create_table_info_cacheRafael França2015-12-291-2/+6
|\ \ \ \ \ | |/ / / / |/| | | | Correctly cache create_table_info
| * | | | Correctly cache create_table_infoRyuta Kamizono2015-12-171-2/+6
| | |_|/ | |/| | | | | | | | | | Follow up to #21664.
* | | | Fix varbinary with default ''Ryuta Kamizono2015-12-241-13/+0
| |_|/ |/| | | | | | | | | | | | | | | | | A `(?:var)?binary` with default '' is a correct definition. Remove `missing_default_forged_as_empty_string?` method for fixing this issue because this method is a workaround for older mysql legacy adapter (19c99ac, f7015336).
* | | Merge pull request #22620 from kamipo/join_to_delete_is_same_as_join_to_updateRafael França2015-12-222-9/+3
|\ \ \ | | | | | | | | `join_to_delete` is same as `join_to_update`
| * | | `join_to_delete` is same as `join_to_update`Ryuta Kamizono2015-12-172-9/+3
| | | | | | | | | | | | | | | | Reapply #22615.
* | | | Add support for passing flags to MySQL2 adapter by arrayStephen Blackstone2015-12-221-1/+6
| | | |
* | | | Remove legacy mysql adapterRyuta Kamizono2015-12-213-9/+8
| | | | | | | | | | | | | | | | Follow up to #22642.
* | | | mysql2 adapter instead of mysql [ci skip]Rajarshi Das2015-12-202-3/+3
| |_|/ |/| |
* | | Handle specified schemas when removing a Postgres indexGrey Baker2015-12-181-3/+16
| | |
* | | Merge pull request #20815 from ↵Matthew Draper2015-12-181-2/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | byroot/do-not-include-column-limit-if-it-is-default Do not include column limit in schema.rb if it matches the default
| * | | Do not include column limit in schema.rb if it matches the defaultJean Boussier2015-07-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When working on engines that supports multiple databases, it's very annoying to have a different schema.rb output based on which database you use. MySQL being the primary offender. This patch should reduce the disparities a bit.
* | | | Merge pull request #22623 from greysteil/support-passing-schema-name-to-indexesMatthew Draper2015-12-181-9/+12
|\ \ \ \ | | | | | | | | | | | | | | | Support passing the schema name prefix to `conenction.indexes`
| * | | | Support passing the schema name prefix to `conenction.indexes`Grey Baker2015-12-171-9/+12
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | Support passing the schema name as a prefix to table name in `ConnectionAdapters::SchemaStatements#indexes`. Previously the prefix would be considered a full part of the index name, and only the schema in the current search path would be considered.
* | | | Merge pull request #19456 from greysteil/index-exists-behaviourMatthew Draper2015-12-181-15/+28
|\ \ \ \ | | | | | | | | | | | | | | | Ignore index name in `index_exists?` when not passed a name to check for
| * | | | Support removing custom-names indexes when only specifying column namesGrey Baker2015-12-151-13/+27
| | | | |
| * | | | Ignore index name in `index_exists?` when not passed a name to check forGrey Baker2015-12-151-2/+1
| | | | |
* | | | | Merge pull request #22642 from seuros/remove-mysql-adapterMatthew Draper2015-12-183-485/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Remove legacy mysql adapter