How to use rake db: migrate

I just want to collapse one version, but I don’t know the current version, is there a command to check it?

+3
source share
3 answers

First, it’s worth the time to read the Rails Guide regarding migration . Then for your specific question:

... rollback of one version:

rake db:rollback STEP=1

... to see the current version:

rake db:version
+8
source

VERSION , . "", . , db/migrate ( ). , .

STEP, .

+2

Migrations have a time stamp. It is safe to assume that the last timestamp is the current migration in most cases.

http://guides.rubyonrails.org/migrations.html#rolling-back

+2
source

Source: https://habr.com/ru/post/1778088/


All Articles