Skip to main content
Active reading. Removed the shell prompts to avoid confusion. Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare).
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

Migrations change the state of the database using the command

$ bundle exec rake db:migrate 
bundle exec rake db:migrate 

We can undo a single migration step using

 $ bundle exec rake db:rollback 
bundle exec rake db:rollback 

To go all the way back to the beginning, we can use

 $ bundle exec rake db:migrate VERSION=0 
bundle exec rake db:migrate VERSION=0 

As you might guess, substituting any other number for 0 migrates to that version number, where the version numbers come from listing the migrations sequentially.

Migrations change the state of the database using the command

$ bundle exec rake db:migrate 

We can undo a single migration step using

 $ bundle exec rake db:rollback 

To go all the way back to the beginning, we can use

 $ bundle exec rake db:migrate VERSION=0 

As you might guess, substituting any other number for 0 migrates to that version number, where the version numbers come from listing the migrations sequentially

Migrations change the state of the database using the command

bundle exec rake db:migrate 

We can undo a single migration step using

bundle exec rake db:rollback 

To go all the way back to the beginning, we can use

bundle exec rake db:migrate VERSION=0 

As you might guess, substituting any other number for 0 migrates to that version number, where the version numbers come from listing the migrations sequentially.

Source Link
Nirupa
  • 787
  • 1
  • 8
  • 20

Migrations change the state of the database using the command

$ bundle exec rake db:migrate 

We can undo a single migration step using

 $ bundle exec rake db:rollback 

To go all the way back to the beginning, we can use

 $ bundle exec rake db:migrate VERSION=0 

As you might guess, substituting any other number for 0 migrates to that version number, where the version numbers come from listing the migrations sequentially