diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-02-25 17:49:32 +0200 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-04-19 21:32:26 +0300 |
commit | b77d2aa0c336492ba33cbfade4964ba0eda3ef84 (patch) | |
tree | dcd6c9d3248d462b4d28a55115c3b0a35edb34e9 /railties | |
parent | c324f5d8bbd717b308776bf47a5fed83ce691e66 (diff) | |
download | rails-b77d2aa0c336492ba33cbfade4964ba0eda3ef84.tar.gz rails-b77d2aa0c336492ba33cbfade4964ba0eda3ef84.tar.bz2 rails-b77d2aa0c336492ba33cbfade4964ba0eda3ef84.zip |
Fix `bin/rails db:forward` first migration
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/application/rake/migrations_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/railties/test/application/rake/migrations_test.rb b/railties/test/application/rake/migrations_test.rb index 449d281967..451045f08b 100644 --- a/railties/test/application/rake/migrations_test.rb +++ b/railties/test/application/rake/migrations_test.rb @@ -142,6 +142,31 @@ module ApplicationTests end end + test "migration status after rollback and forward" do + Dir.chdir(app_path) do + `bin/rails generate model user username:string password:string; + bin/rails generate migration add_email_to_users email:string; + bin/rails db:migrate` + + output = `bin/rails db:migrate:status` + + assert_match(/up\s+\d{14}\s+Create users/, output) + assert_match(/up\s+\d{14}\s+Add email to users/, output) + + `bin/rails db:rollback STEP=2` + output = `bin/rails db:migrate:status` + + assert_match(/down\s+\d{14}\s+Create users/, output) + assert_match(/down\s+\d{14}\s+Add email to users/, output) + + `bin/rails db:forward STEP=2` + output = `bin/rails db:migrate:status` + + assert_match(/up\s+\d{14}\s+Create users/, output) + assert_match(/up\s+\d{14}\s+Add email to users/, output) + end + end + test "migration status after rollback and redo without timestamps" do add_to_config("config.active_record.timestamped_migrations = false") |