aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #15674 from sgrif/sg-mutable-attributesMatthew Draper2014-06-142-8/+4
|\ | | | | Detect in-place changes on mutable AR attributes
| * Detect in-place changes on mutable AR attributesSean Griffin2014-06-132-8/+4
| | | | | | | | | | | | We have several mutable types on Active Record now. (Serialized, JSON, HStore). We need to be able to detect if these have been modified in place.
* | Merge pull request #15593 from sgrif/sg-attributeRafael Mendonça França2014-06-131-2/+3
|\ \ | | | | | | Introduce an Attribute object to handle the type casting dance
| * | Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-131-2/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a lot more that can be moved to these, but this felt like a good place to introduce the object. Plans are: - Remove all knowledge of type casting from the columns, beyond a reference to the cast_type - Move type_cast_for_database to these objects - Potentially make them mutable, introduce a state machine, and have dirty checking handled here as well - Move `attribute`, `decorate_attribute`, and anything else that modifies types to mess with this object, not the columns hash - Introduce a collection object to manage these, reduce allocations, and not require serializing the types
* / PG arrays should type cast user inputSean Griffin2014-06-131-4/+8
|/ | | | | | We guarantee that `model.value` does not change after `model.save && model.reload`. This requires type casting user input for non-string types.
* Inline PG array type casting helperSean Griffin2014-06-103-34/+28
|
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-094-12/+12
| | | | | | | | 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-092-2/+10
| | | | | | | | | | | | | - 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
* 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.
* | Fix behavior of handling BC era dates.edogawaconan2014-06-052-3/+5
|/ | | | BC era year is (astronomical year + 1) and starts from 1 BC.
* Merge pull request #15486 from sgrif/sg-binary-quotingMatthew Draper2014-06-041-10/+21
|\ | | | | 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-031-10/+21
| |
* | pg, preserve money type when dumping schema and extract money default.Yves Senn2014-06-032-0/+8
| |
* | Respect limit for PG bit stringsSean Griffin2014-06-031-19/+19
| |
* | pg, preserve type when schema dumping bit and bit varying columns.Yves Senn2014-06-034-1/+27
|/
* pg, preserve point type when schema dumping.Yves Senn2014-06-032-1/+9
|
* 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
* refactor, introduce `Type#type_cast_for_schema` to cast for schema.rbYves Senn2014-05-302-0/+15
| | | | | | | 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-301-1/+1
| | | | | 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
| |
* | Refactor serialized types to be partially defined as custom propertiesSean Griffin2014-05-291-4/+0
| | | | | | | | | | | | | | 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-281-1/+5
| | | | | | | | | | | | - 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.
* | 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 unwanted `to_sym` call.Kuldeep Aggarwal2014-05-261-1/+1
| |
* | pg, remove duplicated code.Yves Senn2014-05-241-4/+0
| |
* | pg, extract schema definitions into separate file.Yves Senn2014-05-241-0/+138
| | | | | | | | | | | | | | This mirrors the layout of abstract adapter and puts the definitions inside the `PostgreSQL` namespace (no longer under the adapter namespace). /cc @kares
* | Merge pull request #15280 from sgrif/sg-postgres-defaultsRafael Mendonça França2014-05-232-76/+7
|\ \ | | | | | | Move parsing of PG sql strings for defaults out of column
| * | Move parsing of PG sql strings for defaults out of columnSean Griffin2014-05-232-76/+7
| | |
* | | Inline type cast method for PG pointsSean Griffin2014-05-232-8/+4
|/ /
* | Push limit to type objectsSean Griffin2014-05-221-9/+0
| | | | | | | | | | Columns and injected types no longer have any conditionals based on the format of SQL type strings! Hooray!
* | Push scale to type objectsSean Griffin2014-05-221-1/+1
| | | | | | | | | | | | Ideally types will be usable without having to specify a sql type string, so we should keep the information related to parsing them on the adapter or another object.
* | Move `extract_precision` onto type objectsDan Croak and Sean Griffin2014-05-222-13/+2
| |
* | Merge pull request #15249 from sgrif/sg-register-types-in-adapterRafael Mendonça França2014-05-222-73/+13
|\ \ | | | | | | Use the generic type map for all PG type registrations
| * | Use the generic type map for all PG type registrationsSean Griffin2014-05-222-73/+13
| | | | | | | | | | | | | | | | | | | | | We're going to want all of the benefits of the type map object for registrations, including block registration and real aliasing. Moves type name registrations to the adapter, and aliases the OIDs to the named types
* | | Allow additional arguments to be used during type map lookupsSean Griffin2014-05-221-1/+1
|/ / | | | | | | | | | | | | | | Determining things like precision and scale in postgresql will require the given blocks to take additional arguments besides the OID. - Adds the ability to handle additional arguments to `TypeMap` - Passes the column type to blocks when looking up PG types
* | Merge pull request #15218 from sgrif/sg-move-oid-typesRafael Mendonça França2014-05-2123-353/+532
|\ \ | | | | | | Move PG OID types to their own files
| * | Move PG OID types to their own filesSean Griffin2014-05-2123-353/+532
| | | | | | | | | | | | | | | | | | | | | As we promote these classes to first class concepts, these classes are starting to gain enough behavior to warrant being moved into their own files. Many of them will become quite large as we move additional behavior to the type objects.
* | | Rename `oid_type` to `cast_type` to make PG columns consistentSean Griffin2014-05-211-5/+4
|/ /
* | push `extract_scale` to the `Type`.Yves Senn2014-05-212-6/+4
| | | | | | | | | | | | | | - `extract_precision`, `extract_limit`, and `extract_default` probably need to follow. - would be good to remove the delegation `Column#extract_scale`. /cc @sgrif
* | Delegate `type_cast_for_write` to injected type objectSean Griffin2014-05-201-11/+0
| |
* | Merge pull request #15206 from sgrif/sg-type-map-postgresqlRafael Mendonça França2014-05-201-42/+5
|\ \ | | | | | | Use the generic type map for PostgreSQL OID registrations
| * | Use the generic type map for PostgreSQL OID registrationsSean Griffin2014-05-201-42/+5
| | |
* | | Delegate predicate methods to injected type object on ColumnSean Griffin2014-05-202-8/+4
|/ /
* | Merge pull request #15203 from sgrif/sg-delegate-type-castRafael Mendonça França2014-05-201-7/+0
|\ \ | | | | | | Replace `type_cast` case statement with delegation