I seem to have fixed it. I noticed that there was a storage_exists? function in both dm-do-adapter.rb and dm-mysql-adapter.rb.
Commenting out this block in dm-mysql-adapter.rb solves my issue: 21 def storage_exists?(storage_name) 22 select('SHOW TABLES LIKE ?', storage_name).first == storage_name 23 end Tested adding a column and auto_upgrade! now creates the additional column. On Tuesday, March 26, 2013 5:46:58 PM UTC-7, Dan D wrote: > > > I'm migrating an app from sqlite to mysql. auto_upgrade! works great with > sqlite, but crashes with mysql saying that the table already exists. > > > > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-do-adapter.rb:100:in > > `execute_non_query': Table 'inv' already exists (DataObjects::SyntaxError) > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-do-adapter.rb:100:in > > `create_model_storage' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-do-adapter.rb:98:in > > `each' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-do-adapter.rb:98:in > > `create_model_storage' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:276:in > > `with_connection' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-do-adapter.rb:93:in > > `create_model_storage' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-do-adapter.rb:57:in > > `upgrade_model_storage' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:73:in > > `upgrade_model_storage' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:145:in > > `auto_upgrade!' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:47:in > > `send' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:47:in > > `repository_execute' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/support/descendant_set.rb:64:in > > `each' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/support/subject_set.rb:210:in > > `each' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/support/ordered_set.rb:319:in > > `each' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/support/ordered_set.rb:319:in > > `each' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/support/subject_set.rb:210:in > > `each' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/support/descendant_set.rb:63:in > > `each' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:46:in > > `repository_execute' > from > C:/Ruby/lib/ruby/gems/1.8/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:27:in > > `auto_upgrade!' > from hwinv.rb:93 > > > *** model.rb *** > > DataMapper.setup(:default, { > :adapter => 'mysql', > :host => 'localhost', > :username => 'root', > :password => '******', > :database => 'itinv' > }) > > class Inv > include DataMapper::Resource > storage_names[:default] = 'Inv' > > property :id, Serial > property :ComputerName, Text, :field => 'ComputerName' > property :UserName, Text, :field => 'UserName' > end > > > *** app.rb *** > > require 'rubygems' > require 'dm-core' > require 'dm-migrations' > require './model/model' > DataMapper.auto_upgrade! > -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To unsubscribe from this group and stop receiving emails from it, send an email to datamapper+unsubscr...@googlegroups.com. To post to this group, send email to datamapper@googlegroups.com. Visit this group at http://groups.google.com/group/datamapper?hl=en. For more options, visit https://groups.google.com/groups/opt_out.