如何在 heroku 中获取上次迁移的数量 运行?

how to get number of last migration run in heroku?

我正在尝试在 heroku 上调试我的应用程序,但似乎一个或多个迁移没有 运行。在不手动完成每个迁移的情况下,我试图找出哪个迁移是最后一个 运行。

环境:rails、postgresql

来自终端:

 heroku pg:psql --app app_name db_name
 select * from schema_migrations; 

查找最后一个条目

另一种方式...从终端

 heroku run console --app app_name
 class SchemaMigration<ActiveRecord::Base
 end 

那就写

 SchemaMigration.last