为什么rake db:rollback rollback三步?

时间:2021-12-17 16:28:07

Normally when I do

通常当我这样做

$ rake db:rollback

it rolls back one migration. But now, repeatedly times, it has rollbacked 3 steps.

它回滚一次迁移。但现在,反复多次,它已经回滚了3个步骤。

How come this behaviour?

怎么来这个行为?

I'm on Rails 3.2.13.

我在Rails 3.2.13上。

1 个解决方案

#1


33  

You can specify the number of steps like this:

您可以指定这样的步骤数:

rake db:rollback STEP=3

The STEP parameter is actually an environment variable here. If, in your terminal, you run the command echo $STEP, does it return 3? If it does, you can execute export STEP=1 to get back to expected behaviour. If it happens again, try to find out where this environment variable is being set.

STEP参数实际上是一个环境变量。如果在您的终端中运行命令echo $ STEP,它是否返回3?如果是,则可以执行导出STEP = 1以恢复预期的行为。如果再次发生,请尝试找出此环境变量的设置位置。

#1


33  

You can specify the number of steps like this:

您可以指定这样的步骤数:

rake db:rollback STEP=3

The STEP parameter is actually an environment variable here. If, in your terminal, you run the command echo $STEP, does it return 3? If it does, you can execute export STEP=1 to get back to expected behaviour. If it happens again, try to find out where this environment variable is being set.

STEP参数实际上是一个环境变量。如果在您的终端中运行命令echo $ STEP,它是否返回3?如果是,则可以执行导出STEP = 1以恢复预期的行为。如果再次发生,请尝试找出此环境变量的设置位置。