self.up
and up
contains the code that is ran by migrations when you do rake db:migrate
. self.up
is an older version of up
. I'm not sure when they introduced this but until 3.0, they were using self.up
.
self.down
and down
should contain the code that reverses the effect of the up
methods. so if you created a table on up
, you should drop that table on down
. These methods are called when running rake db:rollback
.
На самом деле существует новый метод миграции, называемый change
, который обычно используется, если для рельсов легко определить противоположность тому, что вы делаете, например, создание таблиц.