| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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`.
|
|
|
|
| |
double limits
|
|
|
|
|
|
|
| |
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.
|