http://dev.rubyonrails.org/changeset/7909
------------------------------------------------------------------------
r7909 | bitsweat | 2007-10-15 00:33:53 -0700 (Mon, 15 Oct 2007) | 2 lines
Test that change_column quotes column names. Closes #9537 [lawrence]
------------------------------------------------------------------------
U activerecord\test\migration_test.rb
Updated to revision 7909.
1) Failure:
test_save_for_record_with_only_primary_key(BasicsTest)
[./test/base_test.rb:197:in `test_save_for_record_with_only_primary_key'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `run']:
Exception raised:
Class: <ActiveRecord::StatementInvalid>
Message: <"DBI::DatabaseError: Execute\n OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server\n An explicit value for the identity column in table 'minimalistics' can only be specified when a column list is used and IDENTITY_INSERT is ON.\n HRESULT error code:0x80020009\n Exception occurred.: INSERT INTO minimalistics VALUES(DEFAULT)">
---Backtrace---
./test/../lib/active_record/connection_adapters/abstract_adapter.rb:137:in `log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:337:in `execute_without_counting'
./test/abstract_unit.rb:70:in `execute'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:155:in `insert_sql'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:318:in `insert_sql'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert_without_query_dirty'
./test/../lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `insert'
./test/../lib/active_record/base.rb:2013:in `create_without_callbacks'
./test/../lib/active_record/callbacks.rb:226:in `create_without_timestamps'
./test/../lib/active_record/timestamp.rb:29:in `create'
./test/../lib/active_record/base.rb:1979:in `create_or_update_without_callbacks'
./test/../lib/active_record/callbacks.rb:213:in `create_or_update'
./test/../lib/active_record/base.rb:1731:in `save_without_validation'
./test/../lib/active_record/validations.rb:877:in `save_without_transactions'
./test/../lib/active_record/transactions.rb:105:in `save'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
./test/../lib/active_record/transactions.rb:77:in `transaction'
./test/../lib/active_record/transactions.rb:97:in `transaction'
./test/../lib/active_record/transactions.rb:105:in `save'
./test/../lib/active_record/transactions.rb:117:in `rollback_active_record_state!'
./test/../lib/active_record/transactions.rb:105:in `save'
./test/base_test.rb:197:in `test_save_for_record_with_only_primary_key'
./test/base_test.rb:197:in `test_save_for_record_with_only_primary_key'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `run'
---------------
2) Failure:
test_save_for_record_with_only_primary_key_that_is_provided(BasicsTest)
[./test/base_test.rb:201:in `test_save_for_record_with_only_primary_key_that_is_provided'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `run']:
Exception raised:
Class: <ActiveRecord::StatementInvalid>
Message: <"DBI::DatabaseError: Execute\n OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server\n An explicit value for the identity column in table 'minimalistics' can only be specified when a column list is used and IDENTITY_INSERT is ON.\n HRESULT error code:0x80020009\n Exception occurred.: INSERT INTO minimalistics VALUES(DEFAULT)">
---Backtrace---
./test/../lib/active_record/connection_adapters/abstract_adapter.rb:137:in `log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:337:in `execute_without_counting'
./test/abstract_unit.rb:70:in `execute'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:155:in `insert_sql'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:318:in `insert_sql'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert_without_query_dirty'
./test/../lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `insert'
./test/../lib/active_record/base.rb:2013:in `create_without_callbacks'
./test/../lib/active_record/callbacks.rb:226:in `create_without_timestamps'
./test/../lib/active_record/timestamp.rb:29:in `create'
./test/../lib/active_record/base.rb:1979:in `create_or_update_without_callbacks'
./test/../lib/active_record/callbacks.rb:213:in `create_or_update'
./test/../lib/active_record/base.rb:1737:in `save_without_validation!'
./test/../lib/active_record/validations.rb:887:in `save_without_transactions!'
./test/../lib/active_record/transactions.rb:109:in `save!'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
./test/../lib/active_record/transactions.rb:77:in `transaction'
./test/../lib/active_record/transactions.rb:97:in `transaction'
./test/../lib/active_record/transactions.rb:109:in `save!'
./test/../lib/active_record/transactions.rb:117:in `rollback_active_record_state!'
./test/../lib/active_record/transactions.rb:109:in `save!'
./test/../lib/active_record/validations.rb:852:in `create!'
./test/base_test.rb:201:in `test_save_for_record_with_only_primary_key_that_is_provided'
./test/base_test.rb:201:in `test_save_for_record_with_only_primary_key_that_is_provided'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `run'
---------------
3) Error:
test_scoped_find_limit_offset_including_has_many_association(BasicsTest):
ActiveRecord::StatementInvalid: DBI::DatabaseError: Execute
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
Ambiguous column name 'id'.
HRESULT error code:0x80020009
Exception occurred.: SELECT topics.[id] AS t0_r0, topics.[title] AS t0_r1, topics.[author_name] AS t0_r2, topics.[author_email_address] AS t0_r3, topics.[written_on] AS t0_r4, topics.[bonus_time] AS t0_r5, topics.[last_read] AS t0_r6, topics.[content] AS t0_r7, topics.[approved] AS t0_r8, topics.[replies_count] AS t0_r9, topics.[parent_id] AS t0_r10, topics.[type] AS t0_r11, replies_topics.[id] AS t1_r0, replies_topics.[title] AS t1_r1, replies_topics.[author_name] AS t1_r2, replies_topics.[author_email_address] AS t1_r3, replies_topics.[written_on] AS t1_r4, replies_topics.[bonus_time] AS t1_r5, replies_topics.[last_read] AS t1_r6, replies_topics.[content] AS t1_r7, replies_topics.[approved] AS t1_r8, replies_topics.[replies_count] AS t1_r9, replies_topics.[parent_id] AS t1_r10, replies_topics.[type] AS t1_r11 FROM topics LEFT OUTER JOIN topics replies_topics ON replies_topics.parent_id = topics.id AND replies_topics.[type] = 'Reply' WHERE topics.id IN (2) ORDER BY id
./test/../lib/active_record/connection_adapters/abstract_adapter.rb:137:in `log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:337:in `execute_without_counting'
./test/abstract_unit.rb:70:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:533:in `select'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
./test/../lib/active_record/connection_adapters/abstract/query_cache.rb:55:in `select_all'
./test/../lib/active_record/associations.rb:1237:in `select_all_rows'
./test/../lib/active_record/associations.rb:1119:in `find_with_associations'
./test/../lib/active_record/associations.rb:1117:in `catch'
./test/../lib/active_record/associations.rb:1117:in `find_with_associations'
./test/../lib/active_record/base.rb:1009:in `find_every'
./test/../lib/active_record/base.rb:436:in `find'
./test/base_test.rb:1487:in `test_scoped_find_limit_offset_including_has_many_association'
./test/../lib/active_record/base.rb:1464:in `with_scope'
./test/base_test.rb:1486:in `test_scoped_find_limit_offset_including_has_many_association'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `run'
4) Error:
test_saves_both_date_and_time(DateTimeTest):
ArgumentError: argument out of range
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:106:in `mktime'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:106:in `cast_to_datetime'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:79:in `type_cast'
./test/../lib/active_record/attribute_methods.rb:218:in `read_attribute'
./test/../lib/active_record/base.rb:2207:in `send'
./test/../lib/active_record/base.rb:2207:in `clone_attribute_value'
./test/../lib/active_record/base.rb:2201:in `clone_attributes'
./test/../lib/active_record/attribute_methods.rb:160:in `inject'
./test/../lib/active_record/base.rb:2200:in `each'
./test/../lib/active_record/base.rb:2200:in `inject'
./test/../lib/active_record/base.rb:2200:in `clone_attributes'
./test/../lib/active_record/base.rb:1870:in `attributes'
./test/../lib/active_record/base.rb:2084:in `attributes_with_quotes'
./test/../lib/active_record/base.rb:2003:in `create_without_callbacks'
./test/../lib/active_record/callbacks.rb:226:in `create_without_timestamps'
./test/../lib/active_record/timestamp.rb:29:in `create'
./test/../lib/active_record/base.rb:1979:in `create_or_update_without_callbacks'
./test/../lib/active_record/callbacks.rb:213:in `create_or_update'
./test/../lib/active_record/base.rb:1737:in `save_without_validation!'
./test/../lib/active_record/validations.rb:887:in `save_without_transactions!'
./test/../lib/active_record/transactions.rb:109:in `save!'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
./test/../lib/active_record/transactions.rb:77:in `transaction'
./test/../lib/active_record/transactions.rb:97:in `transaction'
./test/../lib/active_record/transactions.rb:109:in `save!'
./test/../lib/active_record/transactions.rb:117:in `rollback_active_record_state!'
./test/../lib/active_record/transactions.rb:109:in `save!'
./test/date_time_test.rb:11:in `test_saves_both_date_and_time'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `run'
5) Error:
test_eager_association_loading_with_explicit_join(EagerAssociationTest):
ActiveRecord::StatementInvalid: DBI::DatabaseError: Execute
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
HRESULT error code:0x80020009
Exception occurred.: SELECT DISTINCT TOP 1 posts.id FROM posts LEFT OUTER JOIN comments ON comments.post_id = posts.id INNER JOIN authors ON posts.author_id = authors.id AND authors.name = 'Mary' ORDER BY author_id
./test/../lib/active_record/connection_adapters/abstract_adapter.rb:137:in `log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:337:in `execute_without_counting'
./test/abstract_unit.rb:70:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:533:in `select'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
./test/../lib/active_record/connection_adapters/abstract/query_cache.rb:55:in `select_all'
./test/../lib/active_record/associations.rb:1271:in `select_limited_ids_list'
./test/../lib/active_record/associations.rb:1261:in `add_limited_ids_condition!'
./test/../lib/active_record/associations.rb:1250:in `construct_finder_sql_with_included_associations'
./test/../lib/active_record/associations.rb:1238:in `select_all_rows'
./test/../lib/active_record/associations.rb:1119:in `find_with_associations'
./test/../lib/active_record/associations.rb:1117:in `catch'
./test/../lib/active_record/associations.rb:1117:in `find_with_associations'
./test/../lib/active_record/base.rb:1009:in `find_every'
./test/../lib/active_record/base.rb:436:in `find'
./test/associations/eager_test.rb:107:in `test_eager_association_loading_with_explicit_join'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19:in `run'
6) Error:
test_limited_eager_with_multiple_order_columns(EagerAssociationTest):
ActiveRecord::StatementInvalid: DBI::DatabaseError: Execute
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
HRESULT error code:0x80020009
Exception occurred.: SELECT * FROM (SELECT TOP 2 * FROM (SELECT DISTINCT TOP 3 posts.id FROM posts LEFT OUTER JOIN authors ON authors.id = posts.author_id LEFT OUTER JOIN comments ON comments.post_id = posts.id WHERE (authors.name = 'David') ORDER BY UPPER(posts.title), posts.id) AS tmp1 ORDER BY title DESC, id DESC) AS tmp2 ORDER BY title, id
./test/../lib/active_record/connection_adapters/abstract_adapter.rb:137:in `log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:337:in `execute_without_counting'
./test/abstract_unit.rb:70:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:533:in `select'
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
./test/../lib/active_record/connection_adapters/abstract/query_cache.rb:55:in `select_all'
./test/../lib/active_record/associations.rb:1271:in `select_limited_ids_list'
./test/../lib/active_record/associations.rb:1261:in `add_limited_ids_condition!'
./test/../lib/active_record/associations.rb:1250:in `construct_finder_sql_with_included_associations'
./test/../lib/active_record/associations.rb:1238:in `select_all_rows'
./test/../lib/active_record/asso
Hi All,
Is there a specific reason why all those scripts in activerecord/test/fixtures/db_definitions exist instead of one database independent migration file?
> +1 for schema in Ruby format ... I don't think that tests use db
> features
> that AR::Migrations don't support currently.
As you can use execute in migrations, there should be the possibility
of including tests for database-specific implementation. I don't know
if there are any such tests right now, but unless the current
situation is actually broken, I don't see a reason why to fix it.
Michael Glaesemann
grzm seespotcode net
I don't know
if there are any such tests right now, but unless the current
situation is actually broken, I don't see a reason why to fix it.
By the time migrations were added, there were a lot of tests using
those old schema files. Since then, all future additions should have
been made in the ruby schema files. David has asked several times for
someone to clean that up and convert to ruby schema files, but it is a
larger job than it may initially look. Does someone want to give it a
shot?
--
Rick Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
All those sql files under db_definitions need to be moved to
schema.rb, right?
Does it have to be in 1 patch? Maybe we can do this 1 db adapter at a
time, and initially just add a condition to check for the adapter in
schema.rb.
Largely because they were created before migrations and the schema dumper.
There are also some db definitions that can't be done in schema.rb.
> Imo the ability or inability to get the migration file correctly imported
> in the database of your choice is already a test.
All new additions use schema.rb in the same dir.
jeremy
I think that'd be fine. If it's a temporary condition put in place
until the transition is done, just keep it commented so it's obvious
what's going on. Smaller patches are easier to deal with.
Is it OK to create a schema2.rb to be used for the courses table? That
is, in AAACreateTablesTest#test_drop_and_create_courses_table, we can
read schema2.rb in the same way that schema.rb is read in
AAACreateTablesTest#test_load_schema.
Btw, is anyone also working on a patch for MySQL? I'm just checking
coz I'll stop my work on this if anyone already is. I plan to do this
for PostgeSQL after.
On Oct 16, 4:56 pm, Lawrence Pit <lawrence....@gmail.com> wrote:
> See patchhttp://dev.rubyonrails.org/ticket/9897
> >> Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephist...
I actually ended up changing AAACreateTablesTest and I realized what
you mean (that I've just added a patch that affects other databases),
so I guess that wasn't the right argument. For my patch though, it
surely won't work for other databases without the condition that I
added to check if the adapter is MySQL. I guess what I meant is that
since I'm not very familiar with the other database adapters, I'm not
capable of creating a patch for this particular issue that would work
for all. So I was hoping we could do this with the help of other
contributors familiar with the other databases.
Btw, instead of creating 2 patches as I've mentioned before, I didn't
create the patch for removing mysql2.sql and mysql2.drop.sql. Instead,
I just referenced your ticket so there's no wasted effort.
> I guess the one db adapter at a time approach works, but imo we need to
> do this sequentially. So if you create a patch for mysql, then we all
> should first get behind that one and get it into core before we move on
> to the next database adapter.
It would be great if we could do this sequentially.
I'll apply most if not all of your comments. I'll have a closer look
later after work, and expect an updated patch in maybe 10 hours.
Thanks a lot!
http://dev.rubyonrails.org/ticket/9899