aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Remove YAML serialization workaround for columnsSean Griffin2014-06-111-6/+2
| | | | | We are no longer including column objects in YAML serialization, thanks to https://github.com/rails/rails/pull/15621
* Keep the types of virtual columns after yaml serializationSean Griffin2014-06-101-2/+6
| | | | | On MySQL and PostgreSQL, the adapter does not type cast virtual columns for us.
* Inline PG array type casting helperSean Griffin2014-06-103-34/+28
|
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-096-16/+16
| | | | | | | | In some cases there is a difference between the two, we should always be doing one or the other. For convenience, `type_cast` is still a private method on type, so new types that do not need different behavior don't need to implement two methods, but it has been moved to private so it cannot be used accidentally.
* Make `_before_type_cast` actually be before type castSean Griffin2014-06-093-3/+11
| | | | | | | | | | | | | - The following is now true for all types, all the time - `model.attribute_before_type_cast == given_value` - `model.attribute == model.save_and_reload.attribute` - `model.attribute == model.dup.attribute` - `model.attribute == YAML.load(YAML.dump(model)).attribute` - Removes the remaining types implementing `type_cast_for_write` - Simplifies the implementation of time zone aware attributes - Brings tz aware attributes closer to being implemented as an attribute decorator - Adds additional point of control for custom types
* Merge pull request #15546 from sgrif/sg-lazy-decoratorsRafael Mendonça França2014-06-072-12/+22
|\ | | | | Don't query the database schema when calling `serialize`
| * Don't query the database schema when calling `serialize`Sean Griffin2014-06-072-12/+22
| | | | | | | | | | | | We need to decorate the types lazily. This is extracted to a separate API, as there are other refactorings that will be able to make use of it, and to allow unit testing the finer points more granularly.
* | Don't mess with `_before_type_cast` for numeric typesSean Griffin2014-06-061-2/+1
|/
* Merge pull request #15503 from sgrif/sg-json-hstore-storageYves Senn2014-06-062-12/+0
|\ | | | | Bring type casting behavior of hstore/json in line with serialized
| * Bring type casting behavior of hstore/json in line with serializedSean Griffin2014-06-042-12/+0
| | | | | | | | | | `@raw_attributes` should not contain the type-cast, mutable version of the value.
* | Remove optimization that was required with whiny nilsSean Griffin2014-06-051-8/+0
| | | | | | | | Whiny nils is no longer a thing, so we no longer need this optimization
* | Fix behavior of handling BC era dates.edogawaconan2014-06-052-3/+5
| | | | | | | | BC era year is (astronomical year + 1) and starts from 1 BC.
* | have an actual `NullColumn` object and update docs accordingly.Yves Senn2014-06-042-1/+10
| | | | | | | | | | | | Follow up to #15438 and #15502. /cc @sgrif
* | Collapse PG default extractoin of most types to single regexSean Griffin2014-06-041-48/+6
|/ | | | | | | For any type that is represented as a string and then type cast, we do not need separate regular expressions for the various types. No function will match this regex. User defined types *should* match this, so that the type object can decide what to do with the value.
* Change wording of explanation about precision & scale of decimal numbers [ci ↵Prathamesh Sonpatki2014-06-041-2/+2
| | | | skip]
* Merge pull request #15492 from sgrif/sg-dirty-defaultsRafael Mendonça França2014-06-031-1/+1
|\ | | | | Keep column defaults in type cast form
| * Keep column defaults in type cast formSean Griffin2014-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | The contract of `_field_changed?` assumes that the old value is always type cast. That is not the case for the value in `Column#default` as things are today. It appears there are other public methods that assume that `Column#default` is type cast, as well. The reason for this change originally was because the value gets put into `@raw_attributes` in initialize. This reverts to the old behavior on `Column`, and updates `initialize` to make sure that the values are in the right format.
* | Merge pull request #15486 from sgrif/sg-binary-quotingMatthew Draper2014-06-044-47/+65
|\ \ | | | | | | Refactor quoting of binary data to not be based on the column type
| * | Refactor quoting of binary data to not be based on the column typeSean Griffin2014-06-034-47/+65
| |/
* | pg, preserve money type when dumping schema and extract money default.Yves Senn2014-06-033-0/+11
| |
* | Merge pull request #15487 from sgrif/sg-bit-limitYves Senn2014-06-032-24/+24
|\ \ | | | | | | Respect limit for PG bit strings
| * | Respect limit for PG bit stringsSean Griffin2014-06-032-24/+24
| | |
* | | Merge pull request #15442 from sgrif/sg-refactor-field-changedYves Senn2014-06-031-1/+1
|\ \ \ | |/ / |/| | Refactor determination of whether the field has changed
| * | Refactor determination of whether the field has changedSean Griffin2014-06-031-1/+1
| |/ | | | | | | | | The types know more about what is going on than the dirty module. Let's ask them!
* / pg, preserve type when schema dumping bit and bit varying columns.Yves Senn2014-06-035-3/+31
|/
* pg, preserve point type when schema dumping.Yves Senn2014-06-033-2/+11
|
* pg, inline casting methods into `OID::Type` objects.Yves Senn2014-06-024-44/+25
| | | | | | | | This inlines casting for the most obvious types. The rest will follow eventually. I need to put some tests in place, to make sure that the inlining is not causing regressions. /cc @sgrif
* Remove most code related to serialized propertiesSean Griffin2014-06-011-2/+2
| | | | | | | | | | | Nearly completely implemented in terms of custom properties. `_before_type_cast` now stores the raw serialized string consistently, which removes the need to keep track of "state". The following is now consistently true: - `model.serialized == model.reload.serialized` - A model can be dumped and loaded infinitely without changing - A model can be saved and reloaded infinitely without changing
* refactor, introduce `Type#type_cast_for_schema` to cast for schema.rbYves Senn2014-05-304-26/+17
| | | | | | | This removes the case statement in `SchemaDumper` and gives every `Type` the possibility to control the SchemaDumper default value output. /cc @sgrif
* pg, support default values for enum types. Closes #7814.Yves Senn2014-05-302-2/+9
| | | | | This is an intermediate solution. It is related to the refactoring @sgrif is making and will change in the future.
* pg, `default_sequence_name` respects schema. Closes #7516.Yves Senn2014-05-301-2/+2
|
* Merge pull request #11896 from nkondratyev/fix_pg_columns_for_distinctYves Senn2014-05-301-1/+1
|\ | | | | | | | | | | | | Fixed #columns_for_distinct of postgresql adapter Conflicts: activerecord/CHANGELOG.md
| * Fixed `columns_for_distinct` of postgresql adapterNikolay Kondratyev2013-08-151-1/+1
| |
* | pg, `reset_pk_sequence!` respects schemas. Closes #14719.Yves Senn2014-05-301-5/+13
| |
* | pg, `PostgreSQL::Name` to hold schema qualified names.Yves Senn2014-05-303-17/+53
| |
* | Move `type_cast_for_write` behavior over to the serialized type objectSean Griffin2014-05-291-1/+1
| |
* | Refactor serialized types to be partially defined as custom propertiesSean Griffin2014-05-292-6/+4
| | | | | | | | | | | | | | Many of the methods defined in `AttributeMethods::Serialization` can be refactored onto this type as well, but this is a reasonable small step. Removes the `Type` class, and the need for `decorate_columns` to handle serialized types.
* | Ensure we always use instances of the adapter specific column classSean Griffin2014-05-284-5/+14
| | | | | | | | | | | | - Create a consistent API across adapters for building new columns - Use it for custom properties so we don't get `UndefinedMethodError`s in stuff I'm implementing elsewhere.
* | Keep closer to other methods that touch @transactionArthur Neves2014-05-282-4/+4
| |
* | Merge pull request #15370 from sgrif/sg-type-namespaceRafael Mendonça França2014-05-2819-498/+2
|\ \ | | | | | | Move types to the top level `ActiveRecord` namespace
| * | Move types to the top level `ActiveRecord` namespaceSean Griffin2014-05-2719-498/+2
| | | | | | | | | | | | | | | `ActiveRecord::ConnectionAdapters::Type::Value` => `ActiveRecord::Type::Value`
* | | Merge pull request #15387 from sgrif/sg-remove-column-coderSantiago Pastorino2014-05-281-14/+1
|\ \ \ | | | | | | | | Remove unused `Column#coder`
| * | | Remove unused `Column#coder`Sean Griffin2014-05-281-14/+1
| |/ / | | | | | | | | | | | | It appears this property was added, but never actually used. It would be broken if it were, as it only type casts one way.
* / / pg, keep `hstore` and `json` attributes as `Hash` in @attributes.Yves Senn2014-05-282-2/+14
|/ / | | | | | | | | | | | | | | | | | | | | The solution presented in this patch is not efficient. We should replace it in the near future. The following needs to be worked out: * Is `@attributes` storing the Ruby or SQL representation? * `cacheable_column?` is broken but `hstore` and `json` rely on that behavior Refs #15369. /cc @sgrif @rafaelfranca
* | Remove AR Properties from the public APISean Griffin2014-05-2710-10/+10
| | | | | | | | | | Making this part of the public API was premature, let's make it private again while I continue to work on the surrounding code.
* | Merge pull request #15295 from sgrif/sg-deprecate-decimalsRafael Mendonça França2014-05-272-0/+3
|\ \ | | | | | | Deprecate decimal columns being automatically treated as integers
| * | Deprecate decimal columns being automatically treated as integersSean Griffin2014-05-272-0/+3
| | | | | | | | | | | | | | | | | | With ActiveRecord::Properties, we now have a reasonable path for users to continue to keep this behavior if they want it. This is an edge case that has added a lot of complexity to the code base.
* | | Merge pull request #15359 from kuldeepaggarwal/f-remove-unwanted_to_symYves Senn2014-05-271-1/+1
|\ \ \ | | | | | | | | remove unwanted `to_sym` call.
| * | | remove unwanted `to_sym` call.Kuldeep Aggarwal2014-05-261-1/+1
| | | |
* | | | Merge pull request #15353 from sgrif/sg-mysql-conditionRafael Mendonça França2014-05-261-2/+0
|\ \ \ \ | |_|/ / |/| | | Remove unnecessary branch from quoting in Mysql