Skip to content

Instantly share code, notes, and snippets.

@etagwerker
Created May 31, 2011 16:07
Show Gist options
  • Save etagwerker/1000770 to your computer and use it in GitHub Desktop.
Save etagwerker/1000770 to your computer and use it in GitHub Desktop.
DataMapper.auto_upgrade! Question
# Departamento Version 1.0
class Departamento
include DataMapper::Resource
property :id, Serial
property :nombre, String, :index => true
end
# Then I run rackup with DataMapper.auto_upgrade!, which creates the tables with the structure above.
# What if I change something in the structure, eg.
# Departamento Version 1.0
class Departamento
include DataMapper::Resource
property :id, Serial
property :nombre, String, :index => true, :required => true
end
# Then I run rackup again. Will DataMapper.auto_upgrade!, run the proper SQL statements to change the column?
@etagwerker
Copy link
Author

Great, this makes sense. It just wasn't clear enough in the getting started page.

I like your idea about inspecting the data and then allowing or not an auto_upgrade!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment