【发布时间】:2012-02-13 04:08:48
【问题描述】:
我的本地系统上有一个 PostGresql 数据库。我在开发过程中使用了它,我正在尝试在 Heroku 系统上对其进行测试。
请注意,我正在使用 PostGresql,以便可以使用架构。
我在本地系统上完美运行该系统。
我去 Heroku 页面了解如何将我的数据库推送到服务器。 http://devcenter.heroku.com/articles/taps
> heroku db:push
大约 5 分钟后我得到了
"PGError: ERROR: relation "schema_migrations" does not exist"
我想知道的是两个方面.. 在次要层面上,我想知道为什么会这样。我的数据库是从头开始重建的吗? 在主要层面上,我想知道如何解决这个问题。
简介:如何绕过 db:push 上丢失的表?
解决给出的答案中表达的问题。
W:\RUBY\EDM>heroku run rake db:create
Running rake db:create attached to terminal... up, run.1
kzcgkswrss already exists
W:\RUBY\EDM>heroku run rake db:migrate
Running rake db:migrate attached to terminal... up, run.1
W:\RUBY\EDM>heroku db:push
Loaded Taps v0.3.23
Auto-detected local database: postgres://postgres:password@127.0.0.1/EDM2_develo
pment?encoding=utf8
Warning: Data in the app 'xxxx' will be overwritten and will not be r
ecoverable.
! WARNING: Potentially Destructive Action
! This command will affect the app: xxxx
! To proceed, type "xxxx" or re-run this command with --confirm c
xxxx
> xxxxx
Sending schema
Schema: 100% |==========================================| Time: 00:01:56
Sending indexes
schema_migrat: 100% |==========================================| Time: 00:00:01
....
users: 100% |==========================================| Time: 00:00:02
Sending data
31 tables, 5 records
schema_migrat: 0% | | ETA: --:--:--
Saving session to push_201202150351.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: PGError: ERROR: relation "schema_migrations" does not exist
编辑 2
似乎此错误与 postGresql 中存在的第二个模式有关。 看起来它推送了所有公开的空表,但是一旦它尝试推送第二个架构,它就失败了..
【问题讨论】:
-
我真的很想了解在现有数据库上,所述数据库的上传会导致除了目标系统上的副本之外的任何内容。
-
我刚刚编辑了我的代码。有人建议我先运行迁移。在这里,我就是这样做的。尽管推送后的警告表明它没有实际意义。所以现在.. 到错误.. 一个人如何度过它?
标签: ruby-on-rails database postgresql heroku