Skip to content

Instantly share code, notes, and snippets.

@jcbozonier
Created February 10, 2011 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcbozonier/819960 to your computer and use it in GitHub Desktop.
Save jcbozonier/819960 to your computer and use it in GitHub Desktop.
DM migration issue
require 'dm-core'
require 'dm-migrations'
require 'dm-migrations/migration_runner'
DataMapper.setup(:default,{
:adapter=>'mysql',
:database=>'datamapper_test',
:username=>'root',
:password=>'',
:host=>'127.0.0.1'
})
DataMapper::Logger.new(STDOUT, :debug)
DataMapper.logger.debug( "Starting Migration" )
class Person
include DataMapper::Resource
property :id, Serial
property :name, Text
property :age, Integer
end
task :default
task :migrate_down do
migrate_down!
end
task :migrate_up do
migrate_up!
end
migration 1, :create_person_table do
up do
create_table :people do
column :id, Integer, :serial => true
column :name, String, :length=>2
column :age, Integer
end
modify_table :people do
change_column :name, String, :length=>2
end
end
down do
drop_table :people
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment