This project is archived and is in readonly mode.

#6101 ✓invalid
carlallen

drop table fails when the table doesn't exist

Reported by carlallen | December 2nd, 2010 @ 03:08 AM

This causes an error if you try to run tests on the rails codebase and the database is empty.
I have attached a patch to fix the problem.

Comments and changes to this ticket

  • rails

    rails March 3rd, 2011 @ 12:00 AM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails March 3rd, 2011 @ 12:00 AM

    • State changed from “open” to “stale”
  • Anuj Dutta

    Anuj Dutta March 6th, 2011 @ 05:38 PM

    • State changed from “stale” to “invalid”

    This sounds like a bug but I could not reproduce it. I added test to drop a table with a name that I just made up and it did not seem to throw errors. Is there a specific rake task that was ran to produce this error. It would be handy if it could be specified here with an example.

    If you want to have a look at the test that I created then here it is:

    https://github.com/andhapp/rails/tree/ticket-6101

    [state:invalid]

  • carlallen

    carlallen March 7th, 2011 @ 07:23 PM

    rake test_mysql2
    (in /Users/carlallen/Documents/workspace/rails/activerecord) /Users/carlallen/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby -w -I"lib:test:test/connections/native_mysql2" "/Users/carlallen/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/cases/adapter_test.rb" "test/cases/adapters/mysql2/active_schema_test.rb" "test/cases/adapters/mysql2/connection_test.rb" "test/cases/adapters/mysql2/reserved_word_test.rb" "test/cases/aggregations_test.rb" "test/cases/ar_schema_test.rb" "test/cases/associations/belongs_to_associations_test.rb" "test/cases/associations/callbacks_test.rb" "test/cases/associations/cascaded_eager_loading_test.rb" "test/cases/associations/eager_load_includes_full_sti_class_test.rb" "test/cases/associations/eager_load_nested_include_test.rb" "test/cases/associations/eager_singularization_test.rb" "test/cases/associations/eager_test.rb" "test/cases/associations/extension_test.rb" "test/cases/associations/habtm_join_table_test.rb" "test/cases/associations/has_and_belongs_to_many_associations_test.rb" "test/cases/associations/has_many_associations_test.rb" "test/cases/associations/has_many_through_associations_test.rb" "test/cases/associations/has_one_associations_test.rb" "test/cases/associations/has_one_through_associations_test.rb" "test/cases/associations/inner_join_association_test.rb" "test/cases/associations/inverse_associations_test.rb" "test/cases/associations/join_model_test.rb" "test/cases/associations_test.rb" "test/cases/attribute_methods_test.rb" "test/cases/autosave_association_test.rb" "test/cases/base_test.rb" "test/cases/batches_test.rb" "test/cases/binary_test.rb" "test/cases/calculations_test.rb" "test/cases/callbacks_test.rb" "test/cases/clone_test.rb" "test/cases/column_alias_test.rb" "test/cases/column_definition_test.rb" "test/cases/connection_management_test.rb" "test/cases/connection_pool_test.rb" "test/cases/counter_cache_test.rb" "test/cases/database_statements_test.rb" "test/cases/date_time_test.rb" "test/cases/defaults_test.rb" "test/cases/deprecated_finder_test.rb" "test/cases/dirty_test.rb" "test/cases/dup_test.rb" "test/cases/dynamic_finder_match_test.rb" "test/cases/finder_respond_to_test.rb" "test/cases/finder_test.rb" "test/cases/fixtures_test.rb" "test/cases/i18n_test.rb" "test/cases/inheritance_test.rb" "test/cases/invalid_date_test.rb" "test/cases/invertible_migration_test.rb" "test/cases/json_serialization_test.rb" "test/cases/lifecycle_test.rb" "test/cases/locking_test.rb" "test/cases/log_subscriber_test.rb" "test/cases/mass_assignment_security_test.rb" "test/cases/method_scoping_test.rb" "test/cases/migration/command_recorder_test.rb" "test/cases/migration_test.rb" "test/cases/mixin_test.rb" "test/cases/modules_test.rb" "test/cases/multiple_db_test.rb" "test/cases/named_scope_test.rb" "test/cases/nested_attributes_test.rb" "test/cases/persistence_test.rb" "test/cases/pooled_connections_test.rb" "test/cases/primary_keys_test.rb" "test/cases/query_cache_test.rb" "test/cases/quoting_test.rb" "test/cases/readonly_test.rb" "test/cases/reflection_test.rb" "test/cases/relation_scoping_test.rb" "test/cases/relation_test.rb" "test/cases/relations_test.rb" "test/cases/reload_models_test.rb" "test/cases/sanitize_test.rb" "test/cases/schema_dumper_test.rb" "test/cases/serialization_test.rb" "test/cases/session_store/session_test.rb" "test/cases/timestamp_test.rb" "test/cases/transaction_callbacks_test.rb" "test/cases/transactions_test.rb" "test/cases/unconnected_test.rb" "test/cases/validations/association_validation_test.rb" "test/cases/validations/i18n_generate_message_validation_test.rb" "test/cases/validations/i18n_validation_test.rb" "test/cases/validations/uniqueness_validation_test.rb" "test/cases/validations_test.rb" "test/cases/xml_serialization_test.rb" "test/cases/yaml_serialization_test.rb" /Users/carlallen/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/pathname.rb:263: warning: *' interpreted as argument prefix /Users/carlallen/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/bundler-1.0.10/lib/bundler.rb:203: warning: instance variable @checked_for_sudo not initialized Using native Mysql2 /Users/carlallen/Documents/workspace/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:215:inlog': Mysql2::Error: Unknown table 'schema_migrations': DROP TABLE schema_migrations (ActiveRecord::StatementInvalid)

    from /Users/carlallen/Documents/workspace/rails/pg/ruby/1.8/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:314:in `execute_without_query_record'
    from ./test/cases/helper.rb:53:in `execute'
    from /Users/carlallen/Documents/workspace/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:240:in `drop_table'
    from /Users/carlallen/Documents/workspace/rails/pg/ruby/1.8/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:439:in `drop_table'
    from /Users/carlallen/Documents/workspace/rails/activerecord/lib/active_record/schema.rb:49:in `define'
    from /Users/carlallen/Documents/workspace/rails/activerecord/test/schema/schema.rb:1
    from /Users/carlallen/Documents/workspace/rails/activesupport/lib/active_support/dependencies.rb:235:in `load'
    from /Users/carlallen/Documents/workspace/rails/activesupport/lib/active_support/dependencies.rb:235:in `load'
    from /Users/carlallen/Documents/workspace/rails/activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/carlallen/Documents/workspace/rails/activesupport/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/carlallen/Documents/workspace/rails/activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/carlallen/Documents/workspace/rails/activesupport/lib/active_support/dependencies.rb:235:in `load'
    from ./test/cases/helper.rb:111
    from ./test/cases/adapter_test.rb:1:in `require'
    from ./test/cases/adapter_test.rb:1
    from /Users/carlallen/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
    from /Users/carlallen/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
    from /Users/carlallen/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
    from /Users/carlallen/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
    

    rake aborted!
    Command failed with status (1): [/Users/carlallen/.rvm/rubies/ree-1.8.7-201...]

    (See full trace by running task with --trace)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages