aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* fk: `foreign_keys`, `add_foreign_key` and `remove_foreign_key` for MySQLYves Senn2014-06-262-21/+0
|
* fk: add `foreign_keys` for PostgreSQL adapter.Yves Senn2014-06-262-0/+38
|
* fk: `add_foreign_key` and `remove_foreign_key` for PostgreSQL adapter.Yves Senn2014-06-261-0/+27
|
* add missing `:nodoc:` for recent refactorings. [ci skip]Yves Senn2014-06-2423-23/+23
| | | | | | | | | | Adding `# :nodoc:` to the parent `class` / `module` is not going to ignore nested classes or modules. There is a modifier `# :nodoc: all` but sadly the containing class or module will continue to be in the docs. /cc @sgrif
* Don't use column object for type casting in `quoting`Sean Griffin2014-06-181-2/+2
| | | | | | | | | We're never going to be able to use the attribute object here, however, so let's just accept the ugly demeter violation here for now. Remove test cases which were either redundant with other tests in the file, or were actually testing the type objects (which are tested elsewhere)
* Detect in-place changes on point typesSean Griffin2014-06-172-3/+20
|
* Detect mutations of arrays and array membersSean Griffin2014-06-171-12/+14
|
* Ensure `OID::Array#type_cast_for_database` matches PG's quoting behaviorSean Griffin2014-06-172-7/+21
| | | | | | Also takes a step towards supporting types which use a character other than ',' for the delimiter (`box` is the only built in type for which this is the case)
* Merge pull request #15778 from sgrif/sg-pg-mutable-arraysMatthew Draper2014-06-183-38/+52
|\ | | | | Move pg array database type casting to the Array type
| * Move array database type casting to the Array typeSean Griffin2014-06-173-38/+52
| | | | | | | | | | | | | | | | | | The case where we have a column object, but don't have a type cast method involves type casting the default value when changing the schema. We get one of the column definition structs instead. That is a case that I'm trying to remove overall, but in the short term, we can achieve the same behavior without needing to pass the adapter to the array type by creating a fake type that proxies to the adapter.
* | Don't assume that Hstore columns have always changedSean Griffin2014-06-171-1/+1
|/ | | | | | | | | HStore columns come back from the database separated by a comma and a space, not just a comma. We need to mirror that behavior since we compare the two values. Also adds a regression test against JSON to ensure we don't have the same bug there.
* 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