When you run dm:db:automigrate, the following is called:
<code>
DataMapper::Base.auto_migrate!
</code>
When you run the rake task, the following is the result:
<code>
DataObject::QueryError?: Your query failed.
Incorrect table name 'data_mapper/bases'
CREATE TABLE data_mapper/bases (id int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT)
</code>
If you open an irb session, you will see that Base.subclasses is nil.
I opened up the code for DataMapper? 0.2.5 and looked at:
<code>
self.prepare_for_persistence
</code>
in the *persistence.rb* module.
In *self.prepare_for_persistence, You'll notice that subclasses get added to to the *Persistence* class and not *Base*:
<code>
DataMapper::Persistence::subclasses << klass unless klass == DataMapper::Base
</code>
Not exactly sure if subclasses should be added to persistence or to base, but if you change <code>dm:db:auto_migrate</code> to the following, the task works:
<code>
namespace :dm do
namespace :db do
desc "Perform automigration"
task :automigrate => :merb_env do
DataMapper::Persistence.auto_migrate!
end
end
end
</code>