views:

236

answers:

2

I've changed my model from

class Place
  include DataMapper::Resource
  has n, :trails

  property :id,           Serial
  property :name,         String,         :length => 140
  property :tag,          String,         :required => true
  timestamps :at 
end

to

class Place
  include DataMapper::Resource
  has n, :trails

  property :id,           Serial
  property :name,         String,         :length => 140
  property :tag,          String,         :required => true
  property :trail_count,  Integer,        :default => 0
  timestamps :at 
end

I just added "property :trail_count, Integer, :default => 0"

and i want to migrate the existing appengine table to have the extra field "trail_count" i've read that DataMapper.auto_upgrade! should do it.

but i get an error "undefined method `auto_upgrade!' for DataMapper:Module"

can you please help How do i migrate the DM models?

A: 

After restarting the server for the third time the field was miraculously added.

It's still a weird and not so good way to do migrations. how do you manipulate data without migrations? like splitting a field "full name" to first and last name fields? you gotta have a migration for that..

Roy
A: 

I've been looking up the same issue Roy and it appears migrations don't work on app engine using datamapper (or any other interface). It's a function of the datastore, and to update existing database entries you'll have to query the database and update a few at a time to avoid hitting rate limits. source

Mark Essel