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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.