| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
existence
Also:
- updates tests by stubbing table_exists? method
- adds entry for creating indexes in CREATE TABLE to changelog
|
|
|
|
|
|
|
|
| |
This is important, because adding an index on a temporary table after
it has been created would commit the transaction
Conflicts:
activerecord/CHANGELOG.md
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| |
| |
| |
| |
| | |
Only use BINARY for mysql case sensitive uniqueness check when column has a case insensitive collation.
Conflicts:
activerecord/CHANGELOG.md
|
| |
| |
| |
| | |
case insensitive collation.
|
| |
| |
| |
| |
| |
| | |
to make this grant statement described in the document works
GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* to 'rails'@'localhost';
|
| |
| |
| |
| | |
user's system configuration
|
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| | |
Building on the work of #13427 this PR adds a helpful error message to the adapters: mysql, mysql2, and sqlite3
|
|/
|
|
| |
Since MySQL 5.7.3 m13 does now allow primary key column is null.
|
|\
| |
| |
| |
| | |
dougbarth/dont_swallow_exceptions_during_transactional_statements_in_mysql
Don't swallow exceptions in transctional statements
|
| |
| |
| |
| | |
From PR, @tenderlove would prefer to not maintain these tests.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
|
| |
We can conditional define the tests depending on the adapter or
connection.
Lets keep the skip for fail tests that need to be fixed.
|
|\
| |
| | |
Define enable_extension method to prevent undefined method error
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
| |
Don't think class name is needed as by default belongs_to :select will be linked to Select class.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
enum includes text or blob or ... hooked by wrong regex
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Now, connection handles the check for valid types so that each database can handle the changes individually.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
The connection url parssing don't accept the socket option
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit c321b309a9a90bbfa0912832c11b3fef52e71840.
Conflicts:
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
Reason: failing test
1) Error:
test_valid_column(ActiveRecord::ConnectionAdapters::SQLite3AdapterTest):
NoMethodError: undefined method `column' for
test/cases/adapters/sqlite3/sqlite3_adapter_test.rb:29:in
`test_valid_column'
|
|\
| |
| | |
schema dumper tests now conducted by ActiveRecord::Base.Connection
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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 `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.
|
|
|
|
|
|
|
|
|
| |
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`.
|
|
|
|
|
|
|
| |
It doesn't serve much purpose now that ActiveRecord::Base.all returns a
Relation.
The code is moved to active_record_deprecated_finders.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
non-prepared statements
Conflicts:
activerecord/test/cases/query_cache_test.rb
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|