diff options
author | Cristi Balan <evil@che.lu> | 2009-08-08 17:39:31 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-08 17:41:43 +0100 |
commit | 7f84f14efabf3e342a231b8aa9650cb484c802d6 (patch) | |
tree | fe96f90e6e8f2fcbad0c69f92f9b7e8bfa49f6b9 /railties/lib/tasks | |
parent | c284412b149e03f46144ef566bcd6a16750961b1 (diff) | |
download | rails-7f84f14efabf3e342a231b8aa9650cb484c802d6.tar.gz rails-7f84f14efabf3e342a231b8aa9650cb484c802d6.tar.bz2 rails-7f84f14efabf3e342a231b8aa9650cb484c802d6.zip |
Add rake db:forward - opposite of db:rollback [#768 state:resolved]
Example:
rake db:forward # performs the next migration
rake db:forward STEP=4 # performs the next 4 migrations
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'railties/lib/tasks')
-rw-r--r-- | railties/lib/tasks/databases.rake | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index 0d4d658315..b00a789974 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -172,6 +172,13 @@ namespace :db do Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby end + desc 'Pushes the schema to the next version. Specify the number of steps with STEP=n' + task :forward => :environment do + step = ENV['STEP'] ? ENV['STEP'].to_i : 1 + ActiveRecord::Migrator.forward('db/migrate/', step) + Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby + end + desc 'Drops and recreates the database from db/schema.rb for the current environment and loads the seeds.' task :reset => [ 'db:drop', 'db:setup' ] |