如何在我的 Rails 5 应用程序和我的 Heroku 帐户中访问在 Heroku 中上传的数据库?
How Do I Access Databases Uploaded in Heroku in my Rails 5 App and my Heroku Account?
我有一个 Rails 5 应用程序,我已经上传到 Heroku。我有最低的 PostgreSQL 计划(hobby-dev 10,000 行)。我遵循了关于此 link 的导入说明。
当我尝试 运行 我的应用程序时,我收到 relation "xxxx" does not exist
错误和 500 Internal Server Error
。当我检查我的应用程序的数据部分时,我的数据库 none 出现了。我再次尝试从我的多个 AWS S3 数据库转储中执行以下命令。每次我在数据页面上执行刷新命令时,看起来计数都在增加,但是当一切都完成时,我的数据库 none 出现了。我的终端或数据部分没有出现错误,所以我假设数据库不存在。
heroku pg:backups:restore 'https://s3.amazonaws.com/me/items/3H0q/mydb.dump' DATABASE_URL
我收到一封电子邮件,指出我的计划已分配了大约 80% 的行,因此它们在某处。我已经完成 heroku restart
但仍然无法访问它们。我不知道 find/access 数据库或从这里去哪里。
heroku run rails c
的输出:
[xxxxxxxxxx (master)]$ heroku run rails c
Running rails c on ⬢ xxxxxxxx... up, run.4346 (Free)
Loading production environment (Rails 5.0.1)
irb(main):001:0>
你 migrate your database 在 heroku 中吗?这可能是问题所在。
heroku run rake db:migrate
任何时候你想 migrate/seed 或在 heroku 上使用任何 rake 命令,你需要 heroku run
它。
DATABASE_URL represents the HEROKU_POSTGRESQL_COLOR_URL of the database you wish to restore to.
你做了这个了吗? => You must specify a database configuration variable to restore the database.
我有一个 Rails 5 应用程序,我已经上传到 Heroku。我有最低的 PostgreSQL 计划(hobby-dev 10,000 行)。我遵循了关于此 link 的导入说明。
当我尝试 运行 我的应用程序时,我收到 relation "xxxx" does not exist
错误和 500 Internal Server Error
。当我检查我的应用程序的数据部分时,我的数据库 none 出现了。我再次尝试从我的多个 AWS S3 数据库转储中执行以下命令。每次我在数据页面上执行刷新命令时,看起来计数都在增加,但是当一切都完成时,我的数据库 none 出现了。我的终端或数据部分没有出现错误,所以我假设数据库不存在。
heroku pg:backups:restore 'https://s3.amazonaws.com/me/items/3H0q/mydb.dump' DATABASE_URL
我收到一封电子邮件,指出我的计划已分配了大约 80% 的行,因此它们在某处。我已经完成 heroku restart
但仍然无法访问它们。我不知道 find/access 数据库或从这里去哪里。
heroku run rails c
的输出:
[xxxxxxxxxx (master)]$ heroku run rails c
Running rails c on ⬢ xxxxxxxx... up, run.4346 (Free)
Loading production environment (Rails 5.0.1)
irb(main):001:0>
你 migrate your database 在 heroku 中吗?这可能是问题所在。
heroku run rake db:migrate
任何时候你想 migrate/seed 或在 heroku 上使用任何 rake 命令,你需要 heroku run
它。
DATABASE_URL represents the HEROKU_POSTGRESQL_COLOR_URL of the database you wish to restore to.
你做了这个了吗? => You must specify a database configuration variable to restore the database.