简体   繁体   English

Ruby on Rails:无法运行命令“ heroku run rails db:seed”

[英]Ruby on Rails: Cannot run the command 'heroku run rails db:seed'

I just need this run this command in order for my Heroku application's to be in synced with my Workspace's database. 我只需要运行此命令,即可将Heroku应用程序与Workspace的数据库同步。 But when I run this command, it says that I have 9 pending migrations. 但是,当我运行此命令时,它说我有9个挂起的迁移。 I ran rails db:migrate then heroku run rails db:seed, but I still have the same pending migrations. 我先运行rails db:migrate,然后运行heroku运行rails db:seed,但是我仍然有相同的待处理迁移。

When you execute rails db:migrate it will migrate your local database. 当您执行rails db:migrate ,它将迁移您的本地数据库。 To migrate Heroku database you have to use this command heroku run rails db:migrate 要迁移Heroku数据库,您必须使用以下命令heroku run rails db:migrate

Below some steps to run migration and check application in heroku 下面一些步骤在Heroku中运行迁移并检查应用程序

heroku run rake db:migrate
heroku run rake db:seed

I know you did it, but you also need to restart the dyno so it will load new schema with this command below 我知道您已经做到了,但是您还需要重新启动dyno,以便它将使用以下命令加载新架构

heroku restart 

run the server 运行服务器

heroku ps:scale web=1

check the server status 检查服务器状态

heroku ps

if you get web.1: starting .... then your dyno is ready you can open now with 如果您获得web.1:开始....则您的dyno准备就绪,您可以使用

heroku open

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM