错误:关系“地方"不存在 Heroku 数据库导入 [英] ERROR: relation "places" does not exist Heroku db import

查看:40
本文介绍了错误:关系“地方"不存在 Heroku 数据库导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在 postgres 查询中有引号或区分大小写错误时会发生这种错误.实际上,我有一个 .sql 文件,我试图通过命令行将其导入到我的 heroku 数据库中,但不断出现此错误.我的 .sql 文件包含这些查询

I know this kind of error happens when having quotes or case sensitivity error in the query of postgres . Actually i'm having a .sql file which i'm trying to import in my heroku db through command line but constantly having this error .My .sql file contains these queries

INSERT INTO "places" ("Name", "Address") VALUES
('Cookshop Restaurant &amp', ' Bar'),
('Cafeteria', '119 7th Ave, New York, NY 10011'),
('Franchia Vegan Cafe', '12 Park Ave, New York, NY 10016');

推荐答案

问题是 heroku 没有你本地拥有的迁移,为了有相同的 db 版本,在 heroku 上做以下迁移:

The problem is heroku doesn't have the migrations that you locally have, in order to have the same db version do the following migration on heroku:

要了解本地数据库版本,请执行:$ rake db:version

To know the local db version do: $ rake db:version

然后获取您在本地获得的版本,并通过执行以下操作确保您在 heroku 中拥有它:

Then take the version you get locally and make sure you have it in heroku by doing the following:

$ heroku run rake --trace db:migrate VERSION=20151127134901

说明:本质上,上述命令将数据库迁移到与您在本地拥有的迁移版本相同的 heroku.

Explanation: Essentially the above command takes the db migration to heroku with the same version of migration you have locally.

希望能帮到你!

这篇关于错误:关系“地方"不存在 Heroku 数据库导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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