| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
[Andrey Novikov & Łukasz Sarnacki]
|
|\
| |
| | |
Revert "Rename to test_mysql_strict_mode_disabled_dont_override_global_sql_mode"
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit babc24c1b07c1fd58b9b3249b0256f9b0d45c0f0.
Conflicts:
activerecord/test/cases/adapters/mysql/connection_test.rb
activerecord/test/cases/adapters/mysql2/connection_test.rb
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Treat invalid uuid as nil
Conflicts:
activerecord/CHANGELOG.md
|
| |/ |
|
|/ |
|
|\
| |
| | |
Dump PostgreSQL primary key with custom function as a default.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For example, if use pgcrypto extension in PostgreSQL 9.4 beta 1, where
uuid-ossp extension isn't available for moment of writing, and thus to
use a gen_random_uuid() method as a primary key default.
In this case schema dumper wasn't able to correctly reconstruct
create_table statement and lost primary key constraint on schema load.
Fixes #16111.
|
|\ \
| |/
|/| |
Use a type object for type casting behavior on SQLite3
|
| | |
|
|\ \
| | |
| | | |
Don't rely on the sql type to quote XML columns in PG
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| | |
This was only used for uniqueness validations. The first usage was in
conjunction with `limit`. Types which cast to string, but are not
considered text cannot have a limit. The second case was only with an
explicit `:case_sensitive => true` option given by the user.
|
| |
| |
| |
| | |
adapter, fixed from #16057 [ci skip]
|
|\ \
| | |
| | | |
[ci skip] /sqlite/i --> SQLite
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \
| |/ /
|/| | |
Remove unneccessary special case for money in quoting
|
| | | |
|
|\ \ \
| | | |
| | | | |
Do not rely on the column type when quoting infinity
|
| |/ / |
|
|/ / |
|
| |
| |
| |
| |
| | |
The test case for CVE-2014-3483 doesn't actually send the generated SQL
to the database. The generated SQL is actually invalid for real inputs.
|
|/
|
|
| |
Fix CVE-2014-3483 and protect against CVE-2014-3482.
|
| |
|
|
|
|
|
|
|
|
| |
The only case where we got a column that was not `nil`, but did not
respond to `cast_type` was when type casting the default value during
schema creation. We can look up the cast type, and add that object to
the column definition. Will allow us to consistently rely on the type
objects for type casting in all directions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have several test cases on "tricky" types that are essentially
testing that `update_all` goes through the same type casting behavior as
a normal assignment + save. We recently had another case to add this
test for another type in https://github.com/rails/rails/pull/12742.
Rather than testing this separately for every type which is "tricky"
when round tripping, let's instead have a fairly exhaustive test that
ensures we're getting the correct values at every step for `update_all`.
Given the structure of the code now, we can be confident that if the
type is correct, and `update_all` is type casting correctly, we're going
to get the right behavior for all types.
|
| |
|
|\
| |
| | |
Don't type cast the default on the column
|
| |
| |
| |
| |
| |
| |
| | |
If we want to have type decorators mess with the attribute, but not the
column, we need to stop type casting on the column. Where possible, we
changed the tests to test the value of `column_defaults`, which is
public API. `Column#default` is not.
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
Detect in-place changes on mutable AR attributes
|
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
Introduce an Attribute object to handle the type casting dance
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
| |
We guarantee that `model.value` does not change after
`model.save && model.reload`. This requires type casting user input for
non-string types.
|
|
|
|
|
|
|
|
| |
```
activerecord/test/cases/adapters/postgresql/range_test.rb:159: warning: (...) interpreted as grouped expression
activerecord/test/cases/finder_test.rb:38: warning: shadowing outer local variable - e
activerecord/test/cases/finder_test.rb:43: warning: shadowing outer local variable - e
```
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
Remove workaround for non-lazy serialize in tests
|
| |
| |
| |
| | |
`serialize` is now lazy, so the workaround is no longer needed.
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
| |
The times would be equivalent, even if they were in different time
zones. E.g. 12:00 UTC == 5:00 PDT
|
|
|
|
| |
Millisecond inequality causes failures on Travis
|