This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrations rake task. Copied example migrations from examples/ to db/…
…migrations/. Temporarily added a config.rb in the migrations directory for setting up the logger and default database. * rake db:migrate => runs migrations up * DIRECTION=down rake db:migrate => runs migrations down * MIGRATION_DIR rake db:migrate => uses a directory different than ./db/migrations/
- Loading branch information
Bernerd Schaefer
committed
Jun 4, 2008
1 parent
9871145
commit b65c5db
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
migration 1, :create_people_table do | ||
up do | ||
create_table :people do | ||
column :id, Integer, :serial => true | ||
column :name, String, :size => 50 | ||
column :age, Integer | ||
end | ||
end | ||
down do | ||
drop_table :people | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
migration 2, :add_dob_to_people do | ||
up do | ||
modify_table :people do | ||
add_column :dob, DateTime, :nullable? => true | ||
end | ||
end | ||
|
||
down do | ||
modify_table :people do | ||
drop_column :dob | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DataMapper::Logger.new(STDOUT, :debug) | ||
DataMapper.logger.debug( "Starting Migration" ) | ||
|
||
DataMapper.setup(:default, 'postgres://postgres@localhost/dm_core_test') |