将本地数据库数据推送到heroku数据库 [英] Push local database data to heroku database

查看:97
本文介绍了将本地数据库数据推送到heroku数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将Rails项目数据库推到heroku的数据库中.

I was trying to push my rails project database to heroku's database.

我输入这个 heroku pg:push ReadingList_development DATABASE_URL --app quiet-eyrie-9110

( ReadingList_development 是我的本地数据库名称.)

(ReadingList_development is my local database name.)

但是,它显示了此错误

sh: psql: command not found
 !    Heroku client internal error.
 !    Search for help at: https://help.heroku.com
 !    Or report a bug at: https://github.com/heroku/heroku/issues/new

    Error:       psql failed. exit status 32512, output: "" (RuntimeError)
    Command:     heroku pg:push ReadingList_development DATABASE_URL --app calm-eyrie-9110
    Plugins:     heroku-legacy-taps
    Version:     heroku-toolbelt/3.40.6 (x86_64-darwin10.8.0) ruby/1.9.3
    Error ID:    c131ced7e02d4080a3ff53e27d7bd983


    More information in /Users/Coda/.heroku/error.log

这是 error.log

Heroku client internal error.
psql failed. exit status 32512, output: ""
/Users/Coda/.heroku/client/lib/heroku/command/pg.rb:783:in `exec_sql_on_uri'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:108:in `exec_sql_on_uri'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:53:in `ensure_remote_db_empty'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:23:in `prepare'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:14:in `execute'
/Users/Coda/.heroku/client/lib/heroku/command/pg.rb:371:in `push'
/Users/Coda/.heroku/client/lib/heroku/command.rb:212:in `run'
/Users/Coda/.heroku/client/lib/heroku/cli.rb:27:in `start'
/usr/bin/heroku:24:in `<main>'
Heroku client internal error.
psql failed. exit status 32512, output: ""
/Users/Coda/.heroku/client/lib/heroku/command/pg.rb:783:in `exec_sql_on_uri'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:108:in `exec_sql_on_uri'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:53:in `ensure_remote_db_empty'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:23:in `prepare'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:14:in `execute'
/Users/Coda/.heroku/client/lib/heroku/command/pg.rb:371:in `push'
/Users/Coda/.heroku/client/lib/heroku/command.rb:212:in `run'
/Users/Coda/.heroku/client/lib/heroku/cli.rb:27:in `start'
/usr/bin/heroku:24:in `<main>'
Heroku client internal error.
psql failed. exit status 32512, output: ""
/Users/Coda/.heroku/client/lib/heroku/command/pg.rb:783:in `exec_sql_on_uri'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:108:in `exec_sql_on_uri'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:53:in `ensure_remote_db_empty'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:23:in `prepare'
/Users/Coda/.heroku/client/lib/heroku/helpers/pg_dump_restore.rb:14:in `execute'
/Users/Coda/.heroku/client/lib/heroku/command/pg.rb:371:in `push'
/Users/Coda/.heroku/client/lib/heroku/command.rb:212:in `run'
/Users/Coda/.heroku/client/lib/heroku/cli.rb:27:in `start'
/usr/bin/heroku:24:in `<main>`

更新

syndax应该像

Update

syndax should be like

heroku pg:push mylocaldb HEROKU_POSTGRESQL_MAGENTA --app sushi

我不确定 mylocaldb HEROKU_POSTGRESQL_MAGENTA 应该是什么.当我输入

I am not sure what mylocaldb and HEROKU_POSTGRESQL_MAGENTA should be. When I type this

heroku pg:push mylocaldb HEROKU_POSTGRESQL_MAGENTA --app calm-eyrie-9110

返回

Unknown database: HEROKU_POSTGRESQL_MAGENTA. Valid options are: DATABASE_URL

mylocaldb database.yaml 中是否应使用相同的名称?

Does mylocaldb should be the same name in database.yaml?

这是我的 database.yaml 信息

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5

development:
  <<: *default
  database: ReadingList_development

此外,我输入 heroku config:get -a quiet-eyrie-9110

返回

!    Usage: heroku config:get KEY
!    Must specify KEY.

推荐答案

heroku pg:info 将为您提供文档中的颜色( HEROKU_POSTGRESQL_MAGENTA ),或者它将提供类似 postgresql-something-12345

heroku pg:info will either give you the color(HEROKU_POSTGRESQL_MAGENTA) like in the docs, or it will provide something like postgresql-something-12345

其中任何一个都足以满足heroku数据库的要求

Either one of those will suffice in place for the heroku db

这篇关于将本地数据库数据推送到heroku数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆