aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql
Commit message (Collapse)AuthorAgeFilesLines
* use `assert_not` instead of `refute` as mentioned in our guides.Yves Senn2015-08-131-1/+1
| | | | | | | | | | | As described in the "Follow Coding Conventions" section in our contribution guide (http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions) we favor `assert_not` over `refute`. While we don't usually make stylistic changes on it's own I opted to do it in this case. The reason being that test cases are usually copied as a starting point for new tests. This results in a spread of `refute` in files that have been using it already.
* Remove ivar only when definedAkira Matsuda2015-07-241-2/+2
| | | | this fixes a failing test case
* Ensure that microsecond precision is only used for version of mysql that ↵Jori Hardman2015-07-201-0/+14
| | | | support it. Fixes #19711
* make it possible to run AR tests with bin/testYves Senn2015-06-1115-64/+54
|
* If specify `strict: :default` explicitly, do not set sql_mode.Ryuta Kamizono2015-05-261-0/+9
| | | | Related with #17370.
* More exercise the create index sql testsRyuta Kamizono2015-05-041-0/+37
|
* Merge pull request #17569 from kamipo/dump_table_optionsRafael Mendonça França2015-05-031-0/+42
|\ | | | | | | Correctly dump `:options` on `create_table` for MySQL
| * Correctly dump `:options` on `create_table` for MySQLRyuta Kamizono2015-05-031-0/+42
| |
* | Remove unused requireRyuta Kamizono2015-05-031-1/+0
|/
* Use `use_transactional_tests` in Active RecordPrem Sichanugrist2015-04-101-1/+1
| | | | | | `use_transactional_fixtures` was deprecated in favor of `use_transactional_tests` in Rails 5.0. This removes one warning while running test suite.
* Merge pull request #17574 from kamipo/charset_collation_optionsJeremy Kemper2015-04-071-0/+54
|\ | | | | | | Add charset and collation options support for MySQL string and text columns.
| * Add `:charset` and `:collation` options support for MySQL string and text ↵Ryuta Kamizono2015-03-061-0/+54
| | | | | | | | | | | | | | | | | | | | | | columns Example: create_table :foos do |t| t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin' t.text :text_ascii, charset: 'ascii' end
* | Closes rails/rails#18864: Renaming transactional fixtures to transactional testsBrandon Weiss2015-03-163-3/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | I’m renaming all instances of `use_transcational_fixtures` to `use_transactional_tests` and “transactional fixtures” to “transactional tests”. I’m deprecating `use_transactional_fixtures=`. So anyone who is explicitly setting this will get a warning telling them to use `use_transactional_tests=` instead. I’m maintaining backwards compatibility—both forms will work. `use_transactional_tests` will check to see if `use_transactional_fixtures` is set and use that, otherwise it will use itself. But because `use_transactional_tests` is a class attribute (created with `class_attribute`) this requires a little bit of hoop jumping. The writer method that `class_attribute` generates defines a new reader method that return the value being set. Which means we can’t set the default of `true` using `use_transactional_tests=` as was done previously because that won’t take into account anyone using `use_transactional_fixtures`. Instead I defined the reader method manually and it checks `use_transactional_fixtures`. If it was set then it should be used, otherwise it should return the default, which is `true`. If someone uses `use_transactional_tests=` then it will overwrite the backwards-compatible method with whatever they set.
* Prefer `drop_table if_exists: true` over raw SQLRyuta Kamizono2015-02-181-1/+1
| | | | | Lowercase raw SQL has been replaced by 07b659c already. This commit replaces everything else of raw SQL.
* prefer `drop_table if_exists: true` over raw SQL.Yves Senn2015-02-182-2/+2
| | | | | | | /cc @yahonda This makes it easier for third party adapters to run our tests, even if that database does not support IF EXISTS.
* `Type#type_cast_from_database` -> `Type#deserialize`Sean Griffin2015-02-171-1/+1
|
* Extract `DateTimePrecisionTest`Ryuta Kamizono2015-02-131-87/+0
| | | | The datetime precision tests for any adapters is duplicated.
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Remove Relation#bind_paramsSean Griffin2015-01-272-6/+6
| | | | | | | | `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.
* Merge pull request #18067 from ↵Rafael Mendonça França2015-01-021-0/+87
|\ | | | | | | | | | | | | | | | | 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-021-0/+17
| | | | | | | | | | | | | | | | | | 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-021-0/+70
|/
* Stop relying on columns in mysql quoting testsSean Griffin2015-01-011-6/+2
| | | | | The behavior tested by the removed lines is sufficiently covered elsewhere.
* Ensures that primary_key method will return nil when multi-pkArthur Neves2014-12-301-0/+6
| | | | | | | 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.
* Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.Ryuta Kamizono2014-12-121-0/+30
|
* Failure to rollback t.timestamps when within a change_table migrationnoam2014-12-031-1/+1
| | | | | | | | | | | | | 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.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-293-6/+4
|
* synchronize code and docs for `timestamps` and `add_timestamps`.Yves Senn2014-11-201-1/+1
| | | | | | | | This makes the following changes: * warn if `:null` is not passed to `add_timestamps` * `timestamps` method docs link to `add_timestamps` docs * explain where additional options go * adjust examples to include `null: false` (to prevent deprecation warnings)
* Remove the unused second argument to `substitute_at`Sean Griffin2014-11-171-1/+1
| | | | Oh hey, we got to remove some code because of that!
* rm `reorder_bind_params`Sean Griffin2014-11-171-1/+1
| | | | | | Arel handles this for us automatically. Updated tests, as BindParam is no longer a subclass of SqlLiteral. We should remove the second argument to substitute_at entirely, as it's no longer used
* Clear schema cache before each testAkira Matsuda2014-09-011-0/+1
|
* MySQL: set connection collation along with the charsetJeremy Kemper2014-08-301-0/+5
| | | | | | | | | | Sets the connection collation to the database collation configured in database.yml. Otherwise, `SET NAMES utf8mb4` will use the default collation for that charset (utf8mb4_general_ci) when you may have chosen a different collation, like utf8mb4_unicode_ci. This only applies to literal string comparisons, not column values, so it is unlikely to affect you.
* Merge pull request #16481 from sgrif/sg-change-default-timestampsDavid Heinemeier Hansson2014-08-171-1/+1
|\ | | | | Change the default `null` value for timestamps
| * Change the default `null` value for timestampsSean Griffin2014-08-121-1/+1
| | | | | | | | | | | | | | As per discussion, this changes the model generators to specify `null: false` for timestamp columns. A warning is now emitted if `timestamps` is called without a `null` option specified, so we can safely change the behavior when no option is specified in Rails 5.
* | [ci skip] fix spelling of overrideAkshay Vishnoi2014-08-131-1/+1
|/
* Revert "Rename to test_mysql_strict_mode_disabled_dont_override_global_sql_mode"Yasuo Honda2014-07-171-4/+3
| | | | | | | | | This reverts commit babc24c1b07c1fd58b9b3249b0256f9b0d45c0f0. Conflicts: activerecord/test/cases/adapters/mysql/connection_test.rb activerecord/test/cases/adapters/mysql2/connection_test.rb
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-091-1/+1
| | | | | | | | 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.
* Result sets never override a model's column typeSean Griffin2014-05-291-0/+48
| | | | | | | | | | | | 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
* Delegate `Column#type` to the injected type objectSean Griffin2014-05-191-2/+2
| | | | | | | | | | | | | | | | 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.
* Add a type object to Column constructorSean Griffin2014-05-171-2/+2
| | | | | | 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`.
* Changed extract_limit in class Column to return correct mysql float and ↵Aaron Nelson2014-05-161-0/+38
| | | | double limits
* Stringify variables names for mysql connectionsPaul Nikitochkin2014-04-301-0/+8
| | | | | | | 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
* Add ConnectionHelper to refactor tests.Guo Xiang Tan2014-04-032-14/+6
|
* No need to use begin/end blocksRafael Mendonça França2014-03-261-8/+8
|
* No need to gsub the stringRafael Mendonça França2014-03-261-1/+1
|
* Fixes bugs for using indexes in CREATE TABLE by adding checks for table ↵Steve Rice2014-03-251-2/+4
| | | | | | | | existence Also: - updates tests by stubbing table_exists? method - adds entry for creating indexes in CREATE TABLE to changelog
* create indexes inline in CREATE TABLE for MySQLCody Cutrer2014-03-251-0/+11
| | | | | | | | This is important, because adding an index on a temporary table after it has been created would commit the transaction Conflicts: activerecord/CHANGELOG.md
* Clean up tables after each test.Guo Xiang Tan2014-03-222-92/+96
| | | | | | | Follow-Up to https://github.com/rails/rails/pull/14400 This ensures that all tables are removed after each test and thereby allowing us to run the tests in a random order.
* Use teardown helper method.Guo Xiang Tan2014-03-142-2/+2
| | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* Merge pull request #13040 from kamipo/case_sensitive_comparisonRafael Mendonça França2014-03-121-2/+22
|\ | | | | | | | | | | | | Only use BINARY for mysql case sensitive uniqueness check when column has a case insensitive collation. Conflicts: activerecord/CHANGELOG.md