aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate passing `name` to `indexes` like `tables`Ryuta Kamizono2017-01-044-2/+22
| | | | | Passing `name` to `tables` is already deprecated at #21601. Passing `name` to `indexes` is also unused.
* Compare deserialized values for `PostgreSQL::OID::Hstore` typesJon Moss2017-01-031-0/+8
| | | | | | | | | | | | | Per the regression commit below, the commit changes the behavior of `#changed?`to consult the `#changed_in_place?` method on `Type::Value` classes. Per this change, `PostgreSQL::OID::Hstore` needs to override this method in order to compare the deserialized forms of the two arguments. In Ruby, two hashes are considered equal even if their key order is different. This commit helps to bring that behavior to `Hstore` values. Fixes regression introduced by 8e633e505880755e7e366ccec2210bbe2b5436e7 Fixes #27502
* Consistently apply adapter behavior when serializing arraysSean Griffin2017-01-032-13/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | In f1a0fa9 we moved backend specific timestamp behavior out of the type and into the adapter. This was in line with our general attempt to reduce the number of adapter specific type subclasses. However, on PG, the array type performs all serialization, including database encoding in its serialize method. This means that we have converted the value into a string before reaching the database, so no adapter specific logic can be applied (and this also means that timestamp arrays were using the default `.to_s` method on the given object, which likely meant timestamps were being ignored in certain cases as well) Ultimately I want to do a more in depth refactoring which separates database serializer objects from the active model type objects, to give us a less awkward API for introducing the attributes API onto Active Model. However, in the short term, we follow the solution we've applied elsewhere for this. Move behavior off of the type and into the adapter, and use a data object to allow the type to communicate information up the stack. Fixes #27514.
* Merge pull request #27435 from kamipo/follow_up_25307Sean Griffin2017-01-031-2/+2
|\ | | | | Active Record supports MySQL >= 5.1.10
| * Active Record supports MySQL >= 5.1.10Ryuta Kamizono2016-12-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | Follow up to #25307 and #23458. Related with #27422. We are using `information_schema.referential_constraints` since #25307. The table was introduced in MySQL 5.1.10. MySQL 5.0 is too old. It is enough to support >= 5.1.10 at least. MySQL 5.0 GA was released in Dec 2005 and already EOL in Dec 2011. MySQL 5.1 GA was released in Dec 2008 and already EOL in Dec 2013.
* | Revert "Merge pull request #27528 from kamipo/extract_casted_booleans"Kasper Timm Hansen2017-01-011-6/+14
| | | | | | | | | | | | | | | | | | | | | | As pointed out by @matthewd this change makes ImmutableString aware of MysqlString's existence whereas previously MysqlString was only overriding public API. cc @kamipo This reverts commit e632c2fa4cb60072a778ce95c952a0fa95e5b074, reversing changes made to 334a7dcf107cd3ff1697163d331d289d6d65dcd7.
* | Extract `casted_true`/`casted_false` for `Type::ImmutableString`Ryuta Kamizono2017-01-011-14/+6
| | | | | | | | | | | | The only difference between `Type::ImmutableString` and its subclasses is the representation of the casted booleans. Prefer extracting `casted_true`/`casted_false` and override these by subclasses.
* | Dump array subtype options correctlyRyuta Kamizono2017-01-011-1/+1
| | | | | | | | | | Currently schema dumper does not dump array subtype `precision` and `scale` options. This commit fixes the issue.
* | Merge pull request #27441 from koic/quoted_insert_version_sqlKasper Timm Hansen2016-12-311-4/+4
|\ \ | | | | | | Add a quote to an SQL insert statement of schema migration
| * | Add a quote to an SQL insert statement of schema migrationKoichi ITO2016-12-231-4/+4
| |/
* | Remove deprecated `#insert_sql`, `#update_sql`, and `#delete_sql`Ryuta Kamizono2016-12-301-6/+0
| |
* | Remove deprecated support to query using commas on LIMITRafael Mendonça França2016-12-291-6/+1
| |
* | `#tables` and `#table_exists?` and returns only tables and not viewsRafael Mendonça França2016-12-294-69/+55
| |
* | Remove deprecated `name` argument from `#tables`Rafael Mendonça França2016-12-294-22/+4
| |
* | Remove deprecated support to passing a column to #quoteRafael Mendonça França2016-12-291-11/+1
| |
* | Sync the visibility of `sql_for_insert` to privateRyuta Kamizono2016-12-291-1/+1
| | | | | | | | | | The visibility of all internal protected methods was changed to private since 5b14129.
* | Merge pull request #27402 from yui-knk/executeRafael França2016-12-281-1/+1
|\ \ | | | | | | Use `#execute` instead of `@connection.query`
| * | Use `#execute` instead of `@connection.query`yui-knk2016-12-191-1/+1
| |/ | | | | | | | | `@connection.query` bypasses instrumenting "sql.active_record". This behavior preventing us from debugging SQLs which Rails generates.
* | Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-287-33/+33
| | | | | | | | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* | AR::ConnectionAdapters::PostgreSQL::Name#parts is called from other instancesAkira Matsuda2016-12-251-4/+6
| |
* | Privatize unneededly protected methods in Active RecordAkira Matsuda2016-12-248-66/+58
| |
* | No need to nodoc private methodsAkira Matsuda2016-12-242-14/+14
| |
* | Describe what we are protectingAkira Matsuda2016-12-232-0/+4
|/
* Merge pull request #27329 from kamipo/simplify_unsigned_regexEileen M. Uchitelle2016-12-171-2/+1
|\ | | | | Simplify the regex for `unsigned?` method
| * Simplify the regex for `unsigned?` methodRyuta Kamizono2016-12-111-2/+1
| | | | | | | | | | It is enough to distinguish only the trailing `unsigned` and `unsigned zerofill`.
* | fix QueryCache nil dupRichard Monette2016-12-152-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | make sql statements frozen dup if arel is not our string expect runtime error dont wrap runtime error in invalid log errors will now be treated as runtime errors update changelog
* | Merge pull request #27042 from kirs/yaml-schema-cacheRafael França2016-12-132-0/+38
|\ \ | |/ |/| Schema cache in YAML
| * Use YAML to serialize schema cacheKir Shatrov2016-11-272-0/+38
| |
* | Merge pull request #25227 from kamipo/numeric_value_out_of_rangeSean Griffin2016-12-102-0/+6
|\ \ | | | | | | Translate numeric value out of range to the specific exception
| * | Translate numeric value out of range to the specific exceptionRyuta Kamizono2016-12-062-0/+6
| | | | | | | | | | | | Raise `ActiveRecord::RangeError` when values that executed are out of range.
* | | Merge pull request #27278 from kamipo/should_be_sync_primary_key_definitionSean Griffin2016-12-081-1/+1
|\ \ \ | | | | | | | | Should be sync the `primary_key` definition with actually created
| * | | Should be sync the `primary_key` definition with actually createdRyuta Kamizono2016-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actually the `primary_key` definition is not used but the inconsistency is confusing. Actual definition is `bigint auto_increment PRIMARY KEY` so `UNSIGNED` and `(8)` is unnecessary. See also #21607.
* | | | [ci skip] Document regex changeAlex Kitchens2016-12-061-0/+1
| |/ / |/| |
* | | Translate NOT NULL violation to the specific exceptionRyuta Kamizono2016-12-063-0/+9
| | | | | | | | | | | | | | | Raise `ActiveRecord::NotNullViolation` when a record cannot be inserted or updated because it would violate a not null constraint.
* | | Merge pull request #26687 from kamipo/fix_add_index_to_normalize_optionsMatthew Draper2016-12-062-0/+2
|\ \ \ | |/ / |/| | Fix `add_index` to normalize column names and options
| * | Fix `add_index` to normalize column names and optionsRyuta Kamizono2016-10-032-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently does not work the following code. ```ruby add_index(:people, ["last_name", "first_name"], order: { last_name: :desc, first_name: :asc }) ``` Normalize column names and options to fix the issue.
* | | Merge pull request #27274 from kamipo/primary_key_with_auto_increment_and_bigintMatthew Draper2016-12-062-3/+7
|\ \ \ | | | | | | | | Make `:auto_increment` option works on `:bigint`
| * | | Make `:auto_increment` option works on `:bigint`Ryuta Kamizono2016-12-062-3/+7
| | | | | | | | | | | | | | | | Follow up to #27272.
* | | | Make pg adapter use bigserial for pk by defaultPavel Pravosud2016-12-051-1/+23
| | | |
* | | | Change MySQL and Postgresql to use Bigint primary keysJon McCartie2016-12-059-11/+27
|/ / /
* | | Make `:auto_increment` to internal primary key optionRyuta Kamizono2016-12-063-1/+38
| | | | | | | | | | | | | | | | | | Using `:auto_increment` option for abstracting the DB-specific auto incremental types. It is worth to ease to implement the compatibility layer.
* | | Don't try to run multiple insert queries at onceSean Griffin2016-12-051-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SQLite's default query interface ignores anything after the first semicolon in a query. This is actually quite common behavior in database drivers, especially when dealing with code paths for prepared statements (which we are). While this should only affect SQLite, as I'm not aware of any drivers which don't support multi-insert. Even if this does affect other third party drivers though, I'd prefer not to assume that more than one query can be executed per call to `execute`. Fixes #26948. Close #27242.
* | | Fix that `change_column` lose a commentRyuta Kamizono2016-12-051-0/+4
| | |
* | | Stop using the `pg` Float encoderSean Griffin2016-12-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PG's type map assumes that all Ruby floats are going to a field with an OID of type float4 or float8, and generates text which is invalid syntax for other types. Since the gem can handle floats properly without this encoder (albeit slightly slower), we can continue to use that as we have in prior versions of Rails. Fixes #27246
* | | Fix that unsigned with zerofill is treated as signedRyuta Kamizono2016-11-272-2/+2
| | | | | | | | | | | | Fixes #27125.
* | | Clear available connections immediatelyMatthew Draper2016-11-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It'll be re-cleared when it's rebuilt in with_new_connections_blocked's ensure, but we still need to clear it inside this synchronize -- we've disconnected connections that may be available in the queue, and while other threads are not allowed to make *new* connections, they are still allowed to take existing ones from there. This was incorrectly removed in d314646c965b045724e6bdb9d61dcecfabc0ba8f.
* | | Merge pull request #27165 from ↵Rafael França2016-11-251-5/+15
|\ \ \ | | | | | | | | | | | | | | | | prathamesh-sonpatki/followup-uuid-extension-change Followup of UUID default extension in the docs
| * | | Followup of UUID default extension in the docs [ci skip]Prathamesh Sonpatki2016-11-241-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Mentioned clearly that for PostgreSQL < 9.4, you need to pass the default option with "uuid_generate_v4()" - Also updated PostgreSQL Active Record guide with this change. - https://github.com/rails/rails/pull/25395#r66877078
* | | | Merge pull request #27108 from matthewd/allocate-connections-after-blockingMatthew Draper2016-11-251-19/+17
|\ \ \ \ | |/ / / |/| | | Distribute connections to previously blocked threads when we're done
| * | | 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.