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.
This reverts commit 0e407a90413d8a19002b85508d811ccdf2190783, reversing
changes made to 533a9f84b035756eedf9fdccf0c494dc9701ba72.
Conflicts:
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
activerecord/test/cases/migration_test.rb
This reverts commit 81fad6a270ec3cbbb88553c9f2e8200c34fd4d13, reversing
changes made to 23101de283de13517e30c4c3d1ecc65525264886.
Conflicts:
activerecord/test/cases/migration_test.rb
This commit contains a simple failing test that demonstrates the behaviour we expect, and a fix. When using `becomes` to transform the type of an object, it should retain any error information that was present on the original instance.
A recent change made to create_table does away with the
need for the block argument. Checking the arity will prevent the
mixing up of the two syntaxes.
The output in Travis is a bit different. The SQLite
documentation (http://www.sqlite.org/eqp.html) warns
output may change dramatically between releases. I
do not want to mock the result set because I want a
real EXPLAIN to happen. I prefer a test that may fail
in future releases than a test that may give false
positives in future releases.
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.
Building the conditions of a nested through association could
potentially modify the conditions of the through and/or source
association.
This is a Bad Thing.
If a record is removed from a has_many :through, all of the join records
relating to that record should also be removed from the through
association's target.
(Previously the records were removed in the database, but only one was
removed from the in-memory target array.)
This change reduces churn in the db/development_structure.sql file when using :sql as
active_record.schema_format, and makes comparing diffs much easier.
Test ensures the output SQL-statements are lexically ordered by version.