| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
This is an intermediate solution. It is related to the refactoring @sgrif
is making and will change in the future.
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
Fixed #columns_for_distinct of postgresql adapter
Conflicts:
activerecord/CHANGELOG.md
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
MySQL and PostgreSQL provide a column type override in order to properly
type cast computed columns included in a result set. This should never
override the known types of full fledged columns. In addition to messing
up computed properties, this would have led to inconsistent behavior
between a record created with `new`, and a record created with `last` on
the mysql adapter in the following cases:
- `tinyint(1)` with `emulate_booleans` set to `false`
- `text`, `string`, `binary`, and `decimal` columns
|
|\ \
| | |
| | | |
Move types to the top level `ActiveRecord` namespace
|
| | |
| | |
| | |
| | |
| | | |
`ActiveRecord::ConnectionAdapters::Type::Value` =>
`ActiveRecord::Type::Value`
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| | |
|
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
Add an interface for type objects to control Ruby => SQL
|
| | |
| | |
| | |
| | |
| | | |
Adds the ability to save custom types, which type cast to non-primitive
ruby objects.
|
|/ /
| |
| |
| | |
`warning: assigned but unused variable - album`
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
Use the generic type map for all PG type registrations
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | | |
|
| | | |
|
| | | |
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| | |
- Added assertions about the column. Specifically scale.
- Move record insertion from setup into test method.
|
| | |
|
| |
| |
| |
| |
| | |
Using general types where possible. Several more can go away once
infinity gets figured out.
|
| |
| |
| |
| | |
Fixes #14824.
|
| | |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
jcxplorer/fix-enable_extension-with-table_name_prefix
Fix migrations that use enable_extension with table_name_prefix/suffix
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/migration.rb
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When using ActiveRecord::Base.table_name_prefix and/or
table_name_suffix, extension names got the same treatment as table names
when running migrations. This led to migrations that tried to call, for
example, enable_extension("prefix_hstore") on the connection.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | | |
Partial revert of c0bfc3f412834ffe8327a15ae3a46602cc28e425
|
| | |
| | |
| | |
| | |
| | |
| | | |
Part of #15134. In order to perform typecasting polymorphically, we need
to add another argument to the constructor. The order was chosen to
match the `oid_type` on `PostgreSQLColumn`.
|
| | |
| | |
| | |
| | | |
double limits
|
|\ \ \
| | | |
| | | |
| | | | |
[postgres] remove (outer) sub-class declarations with nested modules/classes
|
| | | |
| | | |
| | | |
| | | | |
redundant
|
|/ / / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* by default composite types are mapped as `OID::Identity` and issue a warning
* the user is advised to register his own `OID::Type` to make use of composite types
Registering a new `OID::Type` does currently not allow to specify the type casting
behavior when writing to the database. In order for it to work we need to use the
values within `@attributes`. They are already being type casted and are ready to be
written to the DB.
See https://github.com/rails/rails/blob/57643c961feb24b662620d330e71103a830003e8/activerecord/lib/active_record/attribute_methods.rb#L460-L462
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
Closes #10802.
|
| | |
| | |
| | |
| | | |
Before this patch `Infinity`, `-Infinity` and `Nan` were read as `0`.
|
| | |
| | |
| | |
| | |
| | | |
This test was inspired by #14866. That PR would break this
functionality and we should make sure we notice that in the future.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This resulted in some unrelated errors on Traivs:
1) Error:
PostgresqlUUIDTest#test_treat_blank_uuid_as_nil:
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "thingy" of relation "uuid_data_type" does not exist
LINE 1: INSERT INTO "uuid_data_type" ("thingy") VALUES ($1) RETURNIN...
^
: INSERT INTO "uuid_data_type" ("thingy") VALUES ($1) RETURNING "id"
/cc @zuhao
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Symbolize variables of mysql/mysql2 connection configuration
Conflicts:
activerecord/CHANGELOG.md
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
For mysql2/mysql adapters, `sql_mode` variable name set in `database.yml`
as string, was ignored and `sql_mode` was set to use strict mode.
Fixes #14895
|