Is there a place to review your code? 2010/6/11 J. Pablo Fernández <[email protected]>
> Hello Kim, > > Thanks for the info. Interestingly enough, the problem remains after adding > :force => true, but if I change the table name to :values2 it does work. Is > there some kind of dumped schema I could clean up? Did I find another bug? > > Thanks. > > > On Fri, Jun 11, 2010 at 14:58, Kim Toms <[email protected]> wrote: > >> use :force => true to drop tables before creating them. Here's an example >> from a test of my own: >> >>> class MyMigration < ActiveRecord::Migration >>> def self.up >>> create_table :as, :force => true do |t| >>> t.integer :c_id >>> end >>> create_table :bs, :force => true do |b| >>> b.integer :a_id >>> b.integer :c_id >>> b.timestamps >>> end >>> create_table :cs, :force => true do |b| >>> end >>> end >>> end >> >> >> 2010/6/11 J. Pablo Fernández <[email protected]> >> >>> Hello, >>> >>> I'm a beginner, so any hints are appreciated; I'm still trying to find my >>> way around Rails code. For a bug I've found I need to create a table called >>> "values" so I added this: >>> >>> create_table :values do |t| >>> t.integer :value >>> end >>> >>> among the other table creations in >>> activerecord/test/cases/migration_test.rb. Is that ok? But then, when I run >>> the tests for a second time, I get an error about values already existing. >>> Where are the drop table calls? I couldn't find them. >>> >>> My more immediate problem so far is that I'm getting this error: >>> >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:210:in >>> `log': Mysql::Error: Table 'camelcase' already exists: CREATE TABLE >>> `CamelCase` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `name` >>> varchar(255)) ENGINE=InnoDB (ActiveRecord::StatementInvalid) >>> >>> It started happening when I was playing with adding and not adding value. >>> The whole output is bellow. The puzzling part is that CamelCase doesn't >>> exist. I actually dropped and re-created the activerecord_unittest tables >>> just to be sure. It never creates CamelCase in there. SQlite3 tests run just >>> fine, I haven't tried PostgreSQL. >>> >>> This is the state of the databases just after running the tests and >>> failing: >>> >>> mysql> use activerecord_unittest; >>> Reading table information for completion of table and column names >>> You can turn off this feature to get a quicker startup with -A >>> >>> Database changed >>> mysql> show tables; >>> +---------------------------------+ >>> | Tables_in_activerecord_unittest | >>> +---------------------------------+ >>> | accounts | >>> | admin_accounts | >>> | admin_users | >>> | audit_logs | >>> | author_addresses | >>> | author_favorites | >>> | authors | >>> | auto_id_tests | >>> | binaries | >>> | birds | >>> | books | >>> | booleantests | >>> +---------------------------------+ >>> 12 rows in set (0.00 sec) >>> >>> mysql> use activerecord_unittest2 >>> Database changed >>> mysql> show tables; >>> Empty set (0.00 sec) >>> >>> mysql> >>> >>> Any ideas what's going on? >>> >>> Thanks. >>> -- >>> J. Pablo Fernández <[email protected]> (http://pupeno.com) >>> >>> PS: the whole output: >>> >>> pup...@lennon:~/Projects/rails/rails/activerecord$ rake test_mysql >>> --trace >>> (in /Users/pupeno/Projects/rails/rails/activerecord) >>> ** Invoke test_mysql (first_time) >>> ** Execute test_mysql >>> /Users/pupeno/.rvm/rubies/ruby-1.8.7-p174/bin/ruby -w >>> -I"lib:test:test/connections/native_mysql" >>> "/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" >>> "test/cases/active_schema_test_mysql.rb" "test/cases/adapter_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/column_alias_test.rb" "test/cases/column_definition_test.rb" >>> "test/cases/connection_pool_test.rb" "test/cases/connection_test_mysql.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/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/json_serialization_test.rb" "test/cases/lifecycle_test.rb" >>> "test/cases/locking_test.rb" "test/cases/log_subscriber_test.rb" >>> "test/cases/method_scoping_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/pk_test.rb" >>> "test/cases/pooled_connections_test.rb" "test/cases/query_cache_test.rb" >>> "test/cases/readonly_test.rb" "test/cases/reflection_test.rb" >>> "test/cases/relations_test.rb" "test/cases/reload_models_test.rb" >>> "test/cases/reserved_word_test_mysql.rb" "test/cases/sanitize_test.rb" >>> "test/cases/schema_dumper_test.rb" "test/cases/serialization_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/pupeno/.rvm/gems/ruby-1.8.7-p...@railsdev/gems/bundler-0.9.26/lib/bundler.rb:72: >>> warning: instance variable @setup not initialized >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@railsdev/gems/bundler-0.9.26/lib/bundler/runtime.rb:145: >>> warning: method redefined; discarding old path >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@railsdev/bundler/gems/arel-8151ac946644aab31601d7c0ed944eb9d7ea1e6b-master/lib/arel/algebra/relations/utilities/compound.rb:36: >>> warning: method redefined; discarding old engine >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@railsdev/bundler/gems/arel-8151ac946644aab31601d7c0ed944eb9d7ea1e6b-master/lib/arel/algebra/relations/operations/lock.rb:6: >>> warning: method redefined; discarding old initialize >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@railsdev/bundler/gems/arel-8151ac946644aab31601d7c0ed944eb9d7ea1e6b-master/lib/arel/engines/memory/relations/array.rb:9: >>> warning: method redefined; discarding old initialize >>> Using native MySQL >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:210:in >>> `log': Mysql::Error: Table 'camelcase' already exists: CREATE TABLE >>> `CamelCase` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `name` >>> varchar(255)) ENGINE=InnoDB (ActiveRecord::StatementInvalid) >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:286:in >>> `execute_without_query_record' >>> from ./test/cases/helper.rb:40:in `execute' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:119:in >>> `create_table' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:442:in >>> `create_table' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/migration.rb:356:in >>> `send' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/migration.rb:356:in >>> `method_missing' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/migration.rb:332:in >>> `say_with_time' >>> from >>> /Users/pupeno/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/benchmark.rb:293:in >>> `measure' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/migration.rb:332:in >>> `say_with_time' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/migration.rb:352:in >>> `method_missing' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/test/schema/schema.rb:82 >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/schema.rb:49:in >>> `instance_eval' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/lib/active_record/schema.rb:49:in >>> `define' >>> from >>> /Users/pupeno/Projects/rails/rails/activerecord/test/schema/schema.rb:3 >>> from >>> /Users/pupeno/Projects/rails/rails/activesupport/lib/active_support/dependencies.rb:208:in >>> `load' >>> from >>> /Users/pupeno/Projects/rails/rails/activesupport/lib/active_support/dependencies.rb:208:in >>> `load' >>> from >>> /Users/pupeno/Projects/rails/rails/activesupport/lib/active_support/dependencies.rb:198:in >>> `load_dependency' >>> from >>> /Users/pupeno/Projects/rails/rails/activesupport/lib/active_support/dependencies.rb:554:in >>> `new_constants_in' >>> from >>> /Users/pupeno/Projects/rails/rails/activesupport/lib/active_support/dependencies.rb:198:in >>> `load_dependency' >>> from >>> /Users/pupeno/Projects/rails/rails/activesupport/lib/active_support/dependencies.rb:208:in >>> `load' >>> from ./test/cases/helper.rb:78 >>> from ./test/cases/active_schema_test_mysql.rb:1:in `require' >>> from ./test/cases/active_schema_test_mysql.rb:1 >>> from >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in >>> `load' >>> from /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global >>> /gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5 >>> from >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in >>> `each' >>> from /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global >>> /gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5 >>> rake aborted! >>> Command failed with status (1): >>> [/Users/pupeno/.rvm/rubies/ruby-1.8.7-p174/...] >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:995:in >>> `sh' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:1010:in >>> `call' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:1010:in >>> `sh' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:1094:in >>> `sh' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:1029:in >>> `ruby' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:1094:in >>> `ruby' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake/testtask.rb:117:in >>> `define' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:1112:in >>> `verbose' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake/testtask.rb:102:in >>> `define' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:636:in >>> `call' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:636:in >>> `execute' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:631:in >>> `each' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:631:in >>> `execute' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:597:in >>> `invoke_with_call_chain' >>> /Users/pupeno/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in >>> `synchronize' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:590:in >>> `invoke_with_call_chain' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:583:in >>> `invoke' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:2051:in >>> `invoke_task' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:2029:in >>> `top_level' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:2029:in >>> `each' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:2029:in >>> `top_level' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:2068:in >>> `standard_exception_handling' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:2023:in >>> `top_level' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:2001:in >>> `run' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:2068:in >>> `standard_exception_handling' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/gems/rake-0.8.7/lib/rake.rb:1998:in >>> `run' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global >>> /gems/rake-0.8.7/bin/rake:31 >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/bin/rake:19:in `load' >>> /Users/pupeno/.rvm/gems/ruby-1.8.7-p...@global/bin/rake:19 >>> pup...@lennon:~/Projects/rails/rails/activerecord$ >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Ruby on Rails: Core" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<rubyonrails-core%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-core?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<rubyonrails-core%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-core?hl=en. >> > > > > -- > J. Pablo Fernández <[email protected]> (http://pupeno.com) > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<rubyonrails-core%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
