aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql2
Commit message (Collapse)AuthorAgeFilesLines
* 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 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.
* Go through normal `where` logic when preloading associationsSean Griffin2014-12-261-1/+1
| | | | | | | | | | 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
* 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)
* Build fix when running in isolationArun Agrawal2014-11-141-0/+1
| | | | | `Computer` class needs to be require See #17217 for more details
* add a truncate method to the connectionAaron Patterson2014-09-221-0/+13
| | | | | | it doesn't work on SQLite3 since it doesn't support truncate, but that's OK. If you call truncate on the connection, you're now bound to that database (same as if you use hstore or any other db specific feature).
* MySQL: skip GTID-unsafe statement tests when enforce_gtid_consistency is enabledJeremy Kemper2014-09-011-6/+8
|
* 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
|/
* Merge pull request #16196 from yahonda/mysql_restrict_testMatthew Draper2014-07-171-4/+3
|\ | | | | 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-171-4/+3
| | | | | | | | | | | | | | | | | | This reverts commit babc24c1b07c1fd58b9b3249b0256f9b0d45c0f0. Conflicts: activerecord/test/cases/adapters/mysql/connection_test.rb activerecord/test/cases/adapters/mysql2/connection_test.rb
* | use foreign key DSL in our tests.Yves Senn2014-07-161-2/+2
|/
* active_record: Type cast booleans and durations for string columns.Dylan Thacker-Smith2014-07-061-2/+2
|
* 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
* all tests passing on mysql2Aaron Patterson2014-04-091-3/+3
|
* Add ConnectionHelper to refactor tests.Guo Xiang Tan2014-04-032-16/+7
|
* Fix tests not unsubscribing from Notifications.Guo Xiang Tan2014-03-281-2/+2
| | | | See https://github.com/rails/rails/blob/master/activesupport/lib/active_support/notifications.rb#L131
* 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
* 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.
* Unit test for mysql quote time usecArthur Neves2014-03-121-0/+7
|
* 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
| * Only use BINARY for mysql case sensitive uniqueness check when column has a ↵Ryuta Kamizono2013-11-261-2/+22
| | | | | | | | case insensitive collation.
* | Change the inexistent database name to inexistent_activerecord_unittestYasuo Honda2014-01-011-1/+1
| | | | | | | | | | | | to make this grant statement described in the document works GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* to 'rails'@'localhost';
* | used user-defined configurations for running tests that might depend on ↵Kuldeep Aggarwal2013-12-291-1/+2
| | | | | | | | user's system configuration
* | Move mysql2 test for when adapter will be loadedschneems2013-12-241-0/+7
| | | | | | | | | | | | When run with only the Mysql adapter, we get this failure: https://travis-ci.org/rails/rails/jobs/15937907#L2416 Porting the test over to only run when mysql2 is loaded
* | support creating temporary tables from queriesCody Cutrer2013-12-141-0/+9
| | | | | | | | | | also override drop_table in AbstractMySQLAdapter to properly drop temporary tables without committing the transaction
* | Fix warnings on mysql2 explain testCarlos Antonio da Silva2013-12-101-3/+3
| |
* | Support MySQL 5.7 explainYasuo Honda2013-12-101-3/+3
| |
* | `rename_index`: add the new index before removing the old one.Yves Senn2013-11-261-6/+19
|/ | | | | | | | | | | This prevents the following error when a MySQL index on a foreign key column is renamed: ``` ActiveRecord::StatementInvalid: Mysql2::Error: Cannot drop index 'index_engines_on_car_id': needed in a foreign key constraint: DROP INDEX `index_engines_on_car_id` ON `engines` ``` refs: #13038.
* Merge pull request #12779 from ↵Aaron Patterson2013-11-151-0/+5
|\ | | | | | | | | dougbarth/dont_swallow_exceptions_during_transactional_statements_in_mysql Don't swallow exceptions in transctional statements
| * Remove tests for not swallowing exceptions.Doug Barth2013-11-151-21/+0
| | | | | | | | From PR, @tenderlove would prefer to not maintain these tests.
| * Don't swallow exceptions in transctional statementsDoug Barth2013-11-051-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MySQL connection adapater swallows all StandardError exceptions, which includes Mysql::Error and Mysql2::Error. The comment in the exception clause claims errors thrown here indicate that transactions aren't supported by the server but that isn't necessarily true. It's possible the MySQL server has gone away and swallowing a failed commit may let the application return a successful response when the data has not been saved. Also, replication libraries like Galera require that the application handle exceptions thrown at BEGIN/COMMIT. I'm unable to determine what version of MySQL threw an exception for transactional statements. I tried as far back as 3.23.49 with InnoDB disabled but BEGIN & COMMIT statements do not throw an error. If there's a real case for this logic to continue, we could instead push this behavior into a configuration setting. The exception swallowing has been there since the beginning: db045dbbf60b53dbe013ef25554fd013baf88134
* | Unifies mysql and mysql2 casting of booleans.Yves Senn2013-11-111-3/+3
| |
* | test cases to describe the MySQL boolean behavior.Yves Senn2013-11-111-0/+91
|/
* stop adding singleton methods to the mysql2 adapterAaron Patterson2013-10-041-7/+7
|
* Cleanup of class_nameAnkit Gupta2013-07-281-1/+1
| | | | Don't think class name is needed as by default belongs_to :select will be linked to Select class.
* Revert "Merge pull request #11120 from awilliams/ar_mysql2_boolean_quoting"Yves Senn2013-07-171-25/+0
| | | | | This reverts commit cb1d07e43926bcec95cb8b4a663ca9889173395a, reversing changes made to 754a373e301d2df0b12a11083405252722bc8366.
* Unifies mysql and mysql2 casting of booleansawilliams2013-07-161-0/+25
| | | | | Using the mysql2 adapter, boolean values were sometimes being incorrectly cast to 't' or 'f'. This changes the cast to match the mysql adapter behavior, ie 1 and 0.
* Fix broken mysql testJon Leighton2013-05-031-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | test_mysql_integer_not_null_defaults in test/cases/defaults_test.rb was failing. This test relies on the connection being in strict mode. By default a new connection is not in strict mode, but Active Record automatically places it in strict mode. ActiveSchemaTest overwrites the connection's #execute method in order to prevent SQL statements from actually being executed. One of the operations which is performed in ActiveSchema test is a #recreate_database. Since 2088bf27981137a2c6c8b2f718f33b417b4045af, recreate_database on mysql or mysql2 will trigger a reconnect. Due to the implementation of the hacking of #execute in ActiveSchemaTest, this reconnect would take place, but the connection would *not* be placed in strict mode because #execute had been overridden to prevent SQL queries hitting the database. Therefore, after ActiveSchemaTest, the connection would no longer be in strict mode, causing test_mysql_integer_not_null_defaults to fail. I don't think that the way that ActiveSchemaTest is implemented is particularly nice or clean, but I have taken steps to make its hacks more isolated - it now create a separate connection object which is thrown away after the test, and the hacks are applied on the singleton class of this object.