aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
Commit message (Collapse)AuthorAgeFilesLines
* prefer `drop_table if_exists: true` over raw SQL.Yves Senn2015-02-1811-11/+11
| | | | | | | /cc @yahonda This makes it easier for third party adapters to run our tests, even if that database does not support IF EXISTS.
* `type_cast_from_user` -> `cast`Sean Griffin2015-02-172-5/+5
|
* `type_cast_for_database` -> `serialize`Sean Griffin2015-02-177-18/+18
|
* `Type#type_cast_from_database` -> `Type#deserialize`Sean Griffin2015-02-177-25/+25
|
* Extract `DateTimePrecisionTest`Ryuta Kamizono2015-02-133-271/+0
| | | | The datetime precision tests for any adapters is duplicated.
* pg tests, be clear about the missing type that causes a test skip.Yves Senn2015-02-121-7/+6
| | | | Also removed some cruft in the `setup` and `teardown` methods.
* The datetime precision with zero should be dumpedRyuta Kamizono2015-02-111-22/+39
| | | | | `precision: 0` was not dumped by f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7. However, `precision: 0` is valid value for PostgreSQL timestamps.
* Refactor microsecond precision to be database agnosticSean Griffin2015-02-104-19/+7
| | | | | | | | | | The various databases don't actually need significantly different handling for this behavior, and they can achieve it without knowing about the type of the object. The old implementation was returning a string, which will cause problems such as breaking TZ aware attributes, and making it impossible for the adapters to supply their logic for time objects.
* Fix rounding problem for PostgreSQL timestamp columnRyuta Kamizono2015-02-081-0/+16
| | | | | If timestamp column have the precision, it need to format according to the precision of timestamp column.
* Merge pull request #18602 from kamipo/respect_database_charset_and_collationAndrew White2015-02-081-4/+12
|\ | | | | Respect the database default charset for `schema_migrations` table.
| * Respect the database default charset for `schema_migrations` table.Ryuta Kamizono2015-02-081-4/+12
| | | | | | | | | | | | The charset of `version` column in `schema_migrations` table is depend on the database default charset and collation rather than the encoding of the connection.
* | Remove unused lineRyuta Kamizono2015-02-081-1/+0
|/
* rm `Type#number?`Sean Griffin2015-02-0714-19/+0
| | | | | This predicate is only used in `query_attribute`, and is relatively easy to remove without adding a bunch of is a checks.
* Fix test cases for money, bit and bit_varyingMelody2015-02-042-2/+4
|
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-0320-20/+0
| | | | onwards.
* Remove most type related predicates from `Column`Sean Griffin2015-01-3015-70/+107
| | | | | | Remaining are `limit`, `precision`, `scale`, and `type` (the symbol version). These will remain on the column, since they mirror the options to the `column` method in the schema definition DSL
* Always convert strings to UTF-8, regardless of column type in SQLiteSean Griffin2015-01-281-1/+1
| | | | | | | | All columns which would map to a string primitive need this behavior. Binary has it's own marker type, so it won't go through this conversion. String and text, which need this, will. Fixes #18585.
* Remove Relation#bind_paramsSean Griffin2015-01-277-24/+33
| | | | | | | | `bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
* Fix test failure on PG caused by 7c6f3938dee47f093Sean Griffin2015-01-231-2/+2
|
* Don't error when invalid json is assigned to a JSON columnSean Griffin2015-01-211-0/+8
| | | | | | | Keeping with our behavior elsewhere in the system, invalid input is assumed to be `nil`. Fixes #18629.
* tests, use `drop_table if_exists: true` in our test suite.Yves Senn2015-01-201-1/+1
|
* Should escape regexp wildcard character `.`Ryuta Kamizono2015-01-1911-14/+14
| | | | | `.` is regexp meta character. It should be escape for `assert_match` correctly.
* Stop passing a column to `quote` in testsSean Griffin2015-01-102-6/+7
| | | | | | | I'm planning on deprecating the column argument to mirror the deprecation in [arel]. [arel]: https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
* remove deprecated support for PG ranges with exclusive lower bounds.Yves Senn2015-01-051-27/+5
| | | | addresses https://github.com/rails/rails/commit/91949e48cf41af9f3e4ffba3e5eecf9b0a08bfc3#commitcomment-9144563
* Prefer `array?` rather than `array`Ryuta Kamizono2015-01-0414-20/+20
| | | | | | Slightly refactoring `PostgreSQLColumn`. `array` should be readonly. `default_function` should be initialized by `super`. `sql_type` has been removed `[]`. Since we already choose to remove it we should not change.
* Merge pull request #18067 from ↵Rafael Mendonça França2015-01-022-0/+174
|\ | | | | | | | | | | | | | | | | kamipo/format_datetime_string_according_to_precision Format the datetime string according to the precision of the datetime field. Conflicts: activerecord/CHANGELOG.md
| * Format the datetime string according to the precision of the datetime field.Ryuta Kamizono2015-01-022-0/+34
| | | | | | | | | | | | | | | | | | Incompatible to rounding behavior between MySQL 5.6 and earlier. In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`: http://bugs.mysql.com/bug.php?id=68760
| * Allow precision option for MySQL datetimes.Ryuta Kamizono2015-01-022-0/+140
|/
* Stop explicitly passing `nil` as the column to `type_cast`Sean Griffin2015-01-011-12/+12
| | | | So we can change the arity later.
* Stop depending on columns for type information in PG quoting testsSean Griffin2015-01-012-30/+29
| | | | | | | | A few of the tests weren't testing anything of value. The IP Address tests are testing the type, not behavior of the connection adapter. There are two CVE regression tests which are important, but don't have a good place to go, so I've left them alone for now, as they call `quote` and the focus right now is removing `column` from `type_cast`
* Stop relying on columns for type information in mysql2 casting testsSean Griffin2015-01-011-4/+2
| | | | | | The column itself has no actual impact on the return value. These were actually testing the behavior of the type object, which is sufficiently covered elsewhere.
* Stop relying on columns in mysql quoting testsSean Griffin2015-01-011-6/+2
| | | | | The behavior tested by the removed lines is sufficiently covered elsewhere.
* Stop relying on columns in sqlite quoting testsSean Griffin2015-01-011-22/+1
| | | | | | The string encoding test wasn't using the types for anything. The boolean casting test included logic that should be in the tests for the types, and the string test was legitimately not testing anything useful.
* Ensures that primary_key method will return nil when multi-pkArthur Neves2014-12-303-0/+18
| | | | | | | When table has a composite primary key, the `primary_key` method for sqlite3 and postgresql was only returning the first field of the key. Ensures that it will return nil instead, as AR dont support composite pks.
* Go through normal `where` logic when preloading associationsSean Griffin2014-12-263-3/+3
| | | | | | | | | | This will allow eager type casting to take place as needed. There doesn't seem to be any particular reason that the `in` statement was forced for single values, and the commit message where it was introduced gives no context. See https://github.com/rails/rails/commit/d90b4e2615e8048fdeffc6dffe3246704adee01f
* Correctly ignore `case_sensitive` for UUID uniqueness validationSean Griffin2014-12-261-0/+17
| | | | | | | | I think we should deprecate this behavior and just error if you tell us to do a case insensitive comparison for types which are not case sensitive. Partially reverts 35592307 Fixes #18195
* Dump the default `nil` for PostgreSQL UUID primary key.Ryuta Kamizono2014-12-261-0/+6
|
* Add `force: true` to table created in testsSean Griffin2014-12-221-1/+1
| | | | | | If the test is interrupted in a way that the teardown block fails to run, the tests will fail to run until the table is removed manually without this option.
* Correctly handle limit on int4 and int8 types in PGSean Griffin2014-12-221-0/+25
| | | | | | | | | | | | | | | | PG doesn't register it's types using the `int(4)` format that others do. As such, if we alias `int8` to the other integer types, the range information is lost. This is fixed by simply registering it separately. The other option (which I specifically chose to avoid) is to pass the information of the original type that was being aliased as an argument. I'd rather avoid that, since an alias should truly be treated the same. If we need different behavior for a different type, we should explicitly register it with that, and not have a conditional based on aliasing. Fixes #18144 [Sean Griffin & ysbaddaden]
* `force: :cascade` to recreate tables referenced by foreign-keys.Yves Senn2014-12-191-1/+1
|
* Relax the UUID regexGodfrey Chan2014-12-181-3/+7
| | | | | | | | Apparently PG does not validate against RFC 4122. The intent of the original patch is just to protect against PG errors (which potentially breaks txns, etc) because of bad user input, so we shouldn't try any harder than PG itself. Closes #17931
* Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.Ryuta Kamizono2014-12-122-0/+60
|
* Update test case for TZ aware attributesSean Griffin2014-12-081-4/+14
| | | | | | The test added in 42418cfc94d1356d35d28d786f63e7fab9406ad6 wasn't actually testing anything, since the bug was with TZ aware attributes only.
* Allow custom handling of non-standard types in `time_zone_conversion`Sean Griffin2014-12-081-0/+6
| | | | | | | | | | | | PostgreSQL for example, allows infinity as a valid value for date time columns. The PG type has explicit handling for that case. However, time zone conversion will end up trampling that handling. Unfortunately, we can't call super and then convert time zones. However, if we get back nil from `.in_time_zone`, it's something we didn't expect so we can let the superclass handle it. Fixes #17971
* Revert to 4.1 behavior for casting PG arraysSean Griffin2014-12-081-5/+20
| | | | | | | | | | The user is able to pass PG string literals in 4.1, and have it converted to an array. This is also possible in 4.2, but it would remain in string form until saving and reloading, which breaks our `attr = save.reload.attr` contract. I think we should deprecate this in 5.0, and only allow array input from user sources. However, this currently constitutes a breaking change to public API that did not go through a deprecation cycle.
* Add `force: true` to tables created in PG testsSean Griffin2014-12-052-2/+2
| | | | | | If the tests are interupted and the teardown block doesn't run, the developer needs to delete these manually in order to be able to run the tests again.
* Correctly respect subtypes for PG arrays and rangesSean Griffin2014-12-051-0/+18
| | | | | | | | | | | | | The type registration was simply looking for the OID, and eagerly fetching/constructing the sub type when it was registered. However, numeric types have additional parameters which are extracted from the actual SQL string of the type during lookup, and can have their behavior change based on the result. We simply need to use the block form of registration, and look up the subtype lazily instead. Fixes #17935
* Failure to rollback t.timestamps when within a change_table migrationnoam2014-12-032-2/+2
| | | | | | | | | | | | | When running the following migration: change_table(:table_name) { |t| t/timestamps } The following error was produced: wrong number of arguments (2 for 1) .... /connection_adapters/abstract/schema_statements.rb:851:in `remove_timestamps' This is due to `arguments` containing an empty hash as its second argument.
* pg tests, get rid of global schema `schema_1`.Yves Senn2014-12-021-1/+51
|
* pg tests, move uniqueness validation test to array tests.Yves Senn2014-12-021-0/+15
|