Created
February 10, 2011 04:41
-
-
Save jcbozonier/819960 to your computer and use it in GitHub Desktop.
DM migration issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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