aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Add a public API to allow users to specify column typesSean Griffin2014-05-2611-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | As a result of all of the refactoring that's been done, it's now possible for us to define a public API to allow users to specify behavior. This is an initial implementation so that I can work off of it in smaller pieces for additional features/refactorings. The current behavior will continue to stay the same, though I'd like to refactor towards the automatic schema detection being built off of this API, and add the ability to opt out of automatic schema detection. Use cases: - We can deprecate a lot of the edge cases around types, now that there is an alternate path for users who wish to maintain the same behavior. - I intend to refactor serialized columns to be built on top of this API. - Gem and library maintainers are able to interact with `ActiveRecord` at a slightly lower level in a more stable way. - Interesting ability to reverse the work flow of adding to the schema. Model can become the single source of truth for the structure. We can compare that to what the database says the schema is, diff them, and generate a migration.
* Extract types which don't require additional typecasting to a methodSean Griffin2014-05-261-4/+9
| | | | | Database specific adapters shouldn't need to override `type_cast` to define types which are already in an acceptable state.
* Refactor the type casting of booleans in MySQLSean Griffin2014-05-262-13/+18
|
* Remove checks against `column.type` in abstract adapter quotingSean Griffin2014-05-263-34/+21
| | | | | | The intention is to eventually remove `column` from the arguments list both for `quote` and for `type_cast` entirely. This is the first step to that end.
* Merge pull request #15307 from sgrif/sg-type-cast-for-writeYves Senn2014-05-263-1/+15
|\ | | | | Add an interface for type objects to control Ruby => SQL
| * Add an interface for type objects to control Ruby => SQLSean Griffin2014-05-263-1/+15
| | | | | | | | | | Adds the ability to save custom types, which type cast to non-primitive ruby objects.
* | pg, add missing `:nodoc:` to adapter.Yves Senn2014-05-261-8/+8
| |
* | pg, remove unused code. Use `extract_schema_and_table` instead.Yves Senn2014-05-261-10/+0
| |
* | pg, remove duplicated code.Yves Senn2014-05-241-4/+0
| |
* | pg, extract schema definitions into separate file.Yves Senn2014-05-242-135/+141
|/ | | | | | | This mirrors the layout of abstract adapter and puts the definitions inside the `PostgreSQL` namespace (no longer under the adapter namespace). /cc @kares
* Remove special case in schema dumper for decimal without scaleSean Griffin2014-05-235-35/+32
|
* Merge pull request #15277 from sgrif/sg-schema-cache-refactorRafael Mendonça França2014-05-231-31/+11
|\ | | | | Simplify the code in schema cache
| * Simplify the code in schema cacheSean Griffin2014-05-231-31/+11
| | | | | | | | | | The use of default procs was unnessecary, made the code confusing to follow, and made marshalling needlessly complex.
* | Merge pull request #15282 from sgrif/sg-remove-column-primaryRafael Mendonça França2014-05-231-2/+1
|\ \ | | | | | | Remove `Column#primary`
| * | Remove `Column#primary`Sean Griffin2014-05-231-2/+1
| |/ | | | | | | | | | | | | | | It appears to have been used at some point in the past, but is no longer used in any meaningful way. Whether a column is considered primary is a property of the model, not the schema/column. This also removes the need for yet another layer of caching of the model's schema, and we can leave that to the schema cache.
* | Merge pull request #15280 from sgrif/sg-postgres-defaultsRafael Mendonça França2014-05-233-76/+78
|\ \ | | | | | | Move parsing of PG sql strings for defaults out of column
| * | Move parsing of PG sql strings for defaults out of columnSean Griffin2014-05-233-76/+78
| |/
* / Inline type cast method for PG pointsSean Griffin2014-05-232-8/+4
|/
* Push limit to type objectsSean Griffin2014-05-226-70/+64
| | | | | Columns and injected types no longer have any conditionals based on the format of SQL type strings! Hooray!
* Push precision to type objectsSean Griffin2014-05-226-22/+27
|
* Push scale to type objectsSean Griffin2014-05-227-20/+27
| | | | | | 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-227-19/+15
|
* Merge pull request #15249 from sgrif/sg-register-types-in-adapterRafael Mendonça França2014-05-223-75/+62
|\ | | | | Use the generic type map for all PG type registrations
| * Use the generic type map for all PG type registrationsSean Griffin2014-05-223-75/+62
| | | | | | | | | | | | | | 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-224-12/+12
|/ | | | | | | | 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 #15237 from sgrif/sg-move-extract-scaleRafael Mendonça França2014-05-213-6/+5
|\ | | | | Move extract_scale to decimal type
| * Move extract_scale to decimal typeSean Griffin2014-05-213-6/+5
| | | | | | | | | | | | The only type that has a scale is decimal. There's a special case where decimal columns with 0 scale are type cast to integers if the scale is not specified. Appears to only affect schema dumping.
* | 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
| |/ |/|
* | Add missing nodocs to MySQL adapterSean Griffin2014-05-211-3/+3
|/
* push `extract_scale` to the `Type`.Yves Senn2014-05-214-7/+9
| | | | | | | - `extract_precision`, `extract_limit`, and `extract_default` probably need to follow. - would be good to remove the delegation `Column#extract_scale`. /cc @sgrif
* Delegate `klass` to the injected type objectSean Griffin2014-05-209-14/+33
|
* Delegate `type_cast_for_write` to injected type objectSean Griffin2014-05-204-30/+14
|
* Merge pull request #15207 from sgrif/sg-inline-column-helpersRafael Mendonça França2014-05-208-118/+74
|\ | | | | Inline typecasting helpers from Column to the appropriate types
| * Inline typecasting helpers from Column to the appropriate typesSean Griffin2014-05-208-118/+74
| |
* | Merge pull request #15206 from sgrif/sg-type-map-postgresqlRafael Mendonça França2014-05-203-45/+31
|\ \ | | | | | | Use the generic type map for PostgreSQL OID registrations
| * | Use the generic type map for PostgreSQL OID registrationsSean Griffin2014-05-203-45/+31
| |/
* / Delegate predicate methods to injected type object on ColumnSean Griffin2014-05-2011-23/+43
|/
* Use the generic type map object for mysql field lookupsSean Griffin2014-05-203-23/+26
|
* Merge pull request #15203 from sgrif/sg-delegate-type-castRafael Mendonça França2014-05-206-74/+6
|\ | | | | Replace `type_cast` case statement with delegation
| * Replace `type_cast` case statement with delegationSean Griffin2014-05-206-74/+6
| | | | | | | | | | | | | | | | All subclasses of column were now delegating `type_cast` to their injected type object. We can remove the overriding methods, and generalize it on the `Column` class itself. This also enabled us to remove several column classes completely, as they no longer had any meaningful behavior of their own.
* | Merge pull request #15201 from sgrif/sg-types-postgresqlRafael Mendonça França2014-05-203-147/+81
|\ \ | | | | | | Have Postgres OID types inherit from general types
| * | Have Postgres OID types inherit from general typesSean Griffin2014-05-203-147/+81
| | | | | | | | | | | | | | | Using general types where possible. Several more can go away once infinity gets figured out.
* | | Use general types for mysql fieldsSean Griffin2014-05-201-69/+11
| |/ |/|
* | Delegate type_cast to injected type object in mysqlSean Griffin2014-05-206-53/+72
|/
* Delegate `#type_cast` to injected type objects on SQLite3Sean Griffin2014-05-2010-6/+82
|
* Remove :timestamp column typeSean Griffin2014-05-199-21/+11
| | | | | | | | | | | | The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`.
* Delegate `Column#type` to the injected type objectSean Griffin2014-05-1921-71/+258
| | | | | | | | | | | | | | | | The decision to wrap type registrations in a proc was made for two reasons. 1. Some cases need to make an additional decision based on the type (e.g. a `Decimal` with a 0 scale) 2. Aliased types are automatically updated if they type they point to is updated later. If a user or another adapter decides to change the object used for `decimal` columns, `numeric`, and `number` will automatically point to the new type, without having to track what types are aliased explicitly. Everything else here should be pretty straightforward. PostgreSQL ranges had to change slightly, since the `simplified_type` method is gone.