I am new to Ruby on Rails and Datamapper. Could anyone please tell me what is the difference between rake db:autoupgrade
and rake db:automigrate
in datamapper. Because in my application I have used model A and model B as follows:
class A
includes DataMapper::resource
property :id, Serial
belongs_to :B, :required=>true
end
class B
includes DataMapper::resource
property :id, Serial
has n, :As
end
Then after changing :required => false
in the model A while doing rake db:autoupgrade
no change happens to the A table in database but while doing rake db:automigrate
the following error is coming:
cannot delete or update a parent row: a foreign key constraint fails
if there a foreign key constant you can not delete the associated table. what else you can do is
rake db:drop
and create the table again.