aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql2
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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-14/+22
|
* 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
* Custom index type support with :using.doabit2013-03-242-0/+30
|
* Removed unnecessary blockAnupam Choudhury2013-03-221-2/+1
|
* sets limit 191 for schema_migrations#version in mysql2 if the encoding is ↵Xavier Noria2013-03-171-0/+26
| | | | | | "utf8mb4" Please, see rationale in the included CHANGELOG patch.
* MOAR cleanups.Vipul A M2013-03-141-1/+0
|
* `Connection#structure_dump` is no longer used. #9518Yves Senn2013-03-062-11/+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.
* Remove unnecessary begin..rescue..end, use only rescueAkira Matsuda2013-01-061-7/+5
|
* Session variables for mysql, mysql2, and postgresql adapters can be setAaron Stone2012-12-081-0/+17
| | | | | | | | | in the new 'variables:' hash in each database config section in database.yml. The key-value pairs of this hash will be sent in a 'SET key = value, ...' query on new database connections. The configure_connection methods from mysql and mysql2 into are consolidated into the abstract_mysql base class.
* Use the MySQL varbinary type when appropriate in migrations.Victor Costan2012-10-271-0/+14
|
* Remove ActiveRecord::ModelJon Leighton2012-10-261-6/+6
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
* Rename "Fixtures" class to "FixtureSet"Alexey Muranov2012-10-071-2/+2
| | | | Rename `ActiveRecord::Fixtures` class to `ActiveRecord::FixtureSet`. Instances of this class normally hold a collection of fixtures (records) loaded either from a single YAML file, or from a file and a folder with the same name. This change make the class name singular and makes the class easier to distinguish from the modules like `ActiveRecord::TestFixtures`, which operates on multiple fixture sets, or `DelegatingFixtures`, `::Fixtures`, etc., and from the class `ActiveRecord::Fixture`, which corresponds to a single fixture.
* Rename to test_mysql_strict_mode_disabled_dont_override_global_sql_modeYasuo Honda2012-08-221-3/+4
| | | | | | | | | Reason since MySQL 5.6.6-m9 the `sql_mode` default value is `NO_ENGINE_SUBSTITUTION`. This default parameter change is out of control from Rails. This test verifies Rails not overriding the default `@@GLOBAL.sql_mode` value by checking if `@@GLOBAL.sql_mode` is the same as `@@SESSION.sql_mode`.
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-271-1/+1
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-1/+1
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* fix: limit of enum columns of mysqlYamada Masaki2012-06-281-0/+10
|
* Improve the derivation of HABTM assocation join table namesAndrew White2012-06-221-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve the derivation of HABTM join table name to take account of nesting. It now takes the table names of the two models, sorts them lexically and then joins them, stripping any common prefix from the second table name. Some examples: Top level models (Category <=> Product) Old: categories_products New: categories_products Top level models with a global table_name_prefix (Category <=> Product) Old: site_categories_products New: site_categories_products Nested models in a module without a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: categories_products Nested models in a module with a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: admin_categories_products Nested models in a parent model (Catalog::Category <=> Catalog::Product) Old: categories_products New: catalog_categories_products Nested models in different parent models (Catalog::Category <=> Content::Page) Old: categories_pages New: catalog_categories_content_pages Also as part of this commit the validity checks for HABTM assocations have been moved to ActiveRecord::Reflection One side effect of this is to move when the exceptions are raised from the point of declaration to when the association is built. This is consistant with other association validity checks.
* Fix logs name consistency.kennyj2012-05-191-0/+27
|
* Add config option, rdoc, tests for mysql(2) STRICT_ALL_TABLES mode.Michael Pearson2012-05-051-0/+16
|
* find and replace deprecated keysJon Leighton2012-04-271-1/+1
|
* %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵Jon Leighton2012-04-272-3/+3
| | | | things
* remove calls to find(:first), find(:last) and find(:all)Jon Leighton2012-04-261-1/+1
|
* Change the string to use in test case.kennyj2012-03-071-1/+1
|
* Fix message assertions for quoting database name in "show tables" for mysqlCarlos Antonio da Silva2012-03-041-1/+1
|
* Fix GH #3163. Should quote database on mysql/mysql2.kennyj2012-03-051-0/+11
|
* Fix CIJon Leighton2011-12-281-3/+3
|
* Deprecate set_table_name in favour of self.table_name= or defining your own ↵Jon Leighton2011-11-291-1/+1
| | | | method.
* add the query to AR::Relation#explain outputXavier Noria2011-11-251-0/+3
| | | | | | | Rationale: this is more readable if serveral queries are involved in one call. Also, it will be possible to let AR log EXPLAINs automatically in production mode, where queries are not even around.
* Verify that #3690 has been closed by previous changes to the mysqlJon Leighton2011-11-191-1/+5
| | | | | | | | adapters. These tests fail on the v3.1.2 tag. Closes #3690.
* implements AR::Relation#explainXavier Noria2011-11-051-0/+23
| | | | | | | | | | | | | | | | | | | This is a first implementation, EXPLAIN is highly dependent on the database and I have made some compromises. On one hand, the method allows you to run the most common EXPLAIN and that's it. If you want EXPLAIN ANALYZE in PostgreSQL you need to do it by hand. On the other hand, I've tried to construct a string as close as possible to the ones built by the respective shells. The rationale is that IMO the user should feel at home with the output and recognize it at first sight. Per database. I don't know whether this implementation is going to work well. Let's see whether people like it.
* ambiguous first argument; put parentheses or even spaces Warning removed!Arun Agrawal2011-10-101-2/+2
|
* Remove stray whitespaceJeremy Kemper2011-10-091-4/+1
|
* Only use LOWER for mysql case insensitive uniqueness check when column has a ↵Joseph Palermo2011-10-091-0/+38
| | | | case sensitive collation.
* Remove unused 'y' variable.Sebastian Martinez2011-06-081-2/+2
|