aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * 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-7/+0
| | | | | | | | | | | | 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
* | Raise NoDatabaseError when db does not existschneems2013-12-241-0/+14
| | | | | | Building on the work of #13427 this PR adds a helpful error message to the adapters: mysql, mysql2, and sqlite3
* | Remove `DEFAULT NULL` for primary key column to support MySQL 5.7.3Yasuo Honda2013-12-102-6/+6
|/ | | | Since MySQL 5.7.3 m13 does now allow primary key column is null.
* 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
* | Don't skip tests if we don't need to.Rafael Mendonça França2013-11-082-21/+21
|/ | | | | | | We can conditional define the tests depending on the adapter or connection. Lets keep the skip for fail tests that need to be fixed.
* Merge pull request #11455 from antonio/fix_enable_extension_not_being_definedRafael Mendonça França2013-08-021-0/+12
|\ | | | | Define enable_extension method to prevent undefined method error
| * Define enable_extension method to prevent undefined method errorAntonio Santos2013-08-021-0/+12
| | | | | | | | | | | | | | When mixing postgresql and another adapter like sqlite3 (for dev and test respectively), the task `db:test:prepare` will fail due to the `enable_extension` method not being defined in the abstract adapter. This patch simply adds an empty definition to prevent it.
* | 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.
* add failing test exposing mysql adapter tinyint bugphinze2013-05-151-3/+16
| | | | | | in myself, a column with type TINYINT(N) where N > 1 can be used to represent an integer, but the rails mysql adapter refuses to interpret as anything but a boolean.
* 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.
* fix detect column type of enummasarakki2013-04-011-1/+1
| | | | enum includes text or blob or ... hooked by wrong regex
* Add support for FULLTEXT and SPATIAL indexes using the :type flag for MySQL.Ken Mazaika2013-03-272-16/+24
|
* Checks :algorithm argument for valid valuesDan McClain2013-03-261-0/+4
|
* Adds support for concurrent indexing in PostgreSQL adapterDan McClain2013-03-251-8/+11
| | | | | | | | Adds support for algorithm option in MySQL indexes Moves USING and algorithm options upstream The syntax is still specific to the Adapter, so the actual executed string happens in the corresponding adapter
* Created a layer of abstraction for the valid type checking in schema dumper. ↵Ranjay Krishna2013-03-251-0/+9
| | | | Now, connection handles the check for valid types so that each database can handle the changes individually.
* Custom index type support with :using.doabit2013-03-242-0/+31
|
* Removed unused loop variableAnupam Choudhury2013-03-221-1/+1
|
* Removed unnecessary blockAnupam Choudhury2013-03-201-2/+1
|
* `Connection#structure_dump` is no longer used. #9518Yves Senn2013-03-061-5/+0
| | | | | | | As of ccc6910c we use `mysqldump` to create the `structure.sql`. The old `#structure_dump` code is still in AR but never used. I removed all relevant parts from the code-base.