aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
Commit message (Collapse)AuthorAgeFilesLines
* Add support for Postgresql JSONBPhilippe Creux2014-07-241-9/+25
| | | | [Philippe Creux, Chris Teague]
* Allow to specify a type for foreign key column in migrationsAndrey Novikov2014-07-221-1/+1
| | | | [Andrey Novikov & Łukasz Sarnacki]
* Merge pull request #16196 from yahonda/mysql_restrict_testMatthew Draper2014-07-172-8/+6
|\ | | | | Revert "Rename to test_mysql_strict_mode_disabled_dont_override_global_sql_mode"
| * Revert "Rename to test_mysql_strict_mode_disabled_dont_override_global_sql_mode"Yasuo Honda2014-07-172-8/+6
| | | | | | | | | | | | | | | | | | This reverts commit babc24c1b07c1fd58b9b3249b0256f9b0d45c0f0. Conflicts: activerecord/test/cases/adapters/mysql/connection_test.rb activerecord/test/cases/adapters/mysql2/connection_test.rb
* | Merge pull request #15944 from seuros/uuidRafael Mendonça França2014-07-161-0/+37
|\ \ | | | | | | | | | | | | | | | | | | Treat invalid uuid as nil Conflicts: activerecord/CHANGELOG.md
| * | Treat invalid uuid as nilAbdelkader Boudih2014-07-141-0/+37
| |/
* / use foreign key DSL in our tests.Yves Senn2014-07-161-2/+2
|/
* Merge pull request #16127 from Envek/fix_16111Matthew Draper2014-07-141-0/+23
|\ | | | | Dump PostgreSQL primary key with custom function as a default.
| * Dump PostgreSQL primary key with custom function as a default.Andrey Novikov2014-07-111-0/+23
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #16055 from sgrif/sg-refactor-sqlite3-stringsMatthew Draper2014-07-121-0/+7
|\ \ | |/ |/| Use a type object for type casting behavior on SQLite3
| * Use a type object for type casting behavior on SQLite3Sean Griffin2014-07-111-0/+7
| |
* | Merge pull request #16072 from sgrif/sg-xml-quotingRafael Mendonça França2014-07-081-1/+14
|\ \ | | | | | | Don't rely on the sql type to quote XML columns in PG
| * | Don't rely on the sql type to quote XML columns in PGSean Griffin2014-07-061-1/+14
| | |
* | | Remove the `text?` predicate from the type objectsSean Griffin2014-07-0614-18/+0
|/ / | | | | | | | | | | | | 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.
* | Change back occurrences of SQLite(3) to sqlite3 when referring to theZachary Scott2014-07-061-5/+6
| | | | | | | | adapter, fixed from #16057 [ci skip]
* | Merge pull request #16057 from akshay-vishnoi/doc_changeZachary Scott2014-07-061-2/+2
|\ \ | | | | | | [ci skip] /sqlite/i --> SQLite
| * | [ci skip] /sqlite/i --> SQLiteAkshay Vishnoi2014-07-061-2/+2
| | |
* | | active_record: Type cast booleans and durations for string columns.Dylan Thacker-Smith2014-07-061-2/+2
| | |
* | | Use the type object for quoting PG RangesSean Griffin2014-07-052-6/+6
| | |
* | | Fix typoRafael Mendonça França2014-07-041-1/+1
| | |
* | | Merge pull request #16037 from sgrif/sg-money-quotingRafael Mendonça França2014-07-041-0/+24
|\ \ \ | |/ / |/| | Remove unneccessary special case for money in quoting
| * | Remove unneccessary special case for money in quotingSean Griffin2014-07-031-0/+24
| | |
* | | Merge pull request #16036 from sgrif/sg-datetime-infinityRafael Mendonça França2014-07-031-0/+44
|\ \ \ | | | | | | | | Do not rely on the column type when quoting infinity
| * | | Do not rely on the column type when quoting infinitySean Griffin2014-07-031-0/+44
| |/ /
* / / Use the type object for type casting HStore columnsSean Griffin2014-07-031-11/+5
|/ /
* | Quote range strings when quoting PG rangesSean Griffin2014-07-022-1/+18
| | | | | | | | | | 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 SQL injection when querying against ranges and bitstringsRafael Mendonça França2014-07-021-0/+11
|/ | | | Fix CVE-2014-3483 and protect against CVE-2014-3482.
* Use the type object for sending JSON to the databaseSean Griffin2014-06-291-1/+1
|
* Always pass a column with a type object to quoteSean Griffin2014-06-281-2/+2
| | | | | | | | 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.
* [Postgresql tests] remove duplicate helperAbdelkader Boudih2014-06-281-12/+3
|
* Consolidate testing of update_all type castingSean Griffin2014-06-263-30/+0
| | | | | | | | | | | | | | 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.
* Reconnect after possibly enabling hstoreMatthew Draper2014-06-181-0/+2
|
* Merge pull request #15782 from sgrif/sg-column-defaultsMatthew Draper2014-06-188-24/+13
|\ | | | | Don't type cast the default on the column
| * Don't type cast the default on the columnSean Griffin2014-06-178-24/+13
| | | | | | | | | | | | | | 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.
* | Detect in-place changes on point typesSean Griffin2014-06-171-0/+11
| |
* | Enable hstore in array testsSean Griffin2014-06-171-0/+6
| |
* | Detect mutations of arrays and array membersSean Griffin2014-06-171-0/+23
| |
* | Ensure `OID::Array#type_cast_for_database` matches PG's quoting behaviorSean Griffin2014-06-172-0/+33
|/ | | | | | 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)
* Don't assume that Hstore columns have always changedSean Griffin2014-06-172-1/+3
| | | | | | | | | 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-0/+29
|\ | | | | Detect in-place changes on mutable AR attributes
| * Detect in-place changes on mutable AR attributesSean Griffin2014-06-132-0/+29
| | | | | | | | | | | | 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-1/+1
|\ \ | | | | | | Introduce an Attribute object to handle the type casting dance
| * | Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-131-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+7
|/ | | | | | We guarantee that `model.value` does not change after `model.save && model.reload`. This requires type casting user input for non-string types.
* Silence warnings in tests.Sean Griffin2014-06-101-1/+1
| | | | | | | | ``` 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 ```
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-097-27/+27
| | | | | | | | 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.
* Merge pull request #15587 from sgrif/sg-remove-workaroundRafael Mendonça França2014-06-091-15/+8
|\ | | | | Remove workaround for non-lazy serialize in tests
| * Remove workaround for non-lazy serialize in testsSean Griffin2014-06-091-15/+8
| | | | | | | | `serialize` is now lazy, so the workaround is no longer needed.
* | Make `_before_type_cast` actually be before type castSean Griffin2014-06-093-1/+7
|/ | | | | | | | | | | | | - 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
* Ensure time zones don't change after round trip with array columnsSean Griffin2014-06-071-0/+2
| | | | | The times would be equivalent, even if they were in different time zones. E.g. 12:00 UTC == 5:00 PDT