gpt4 book ai didi

ruby-on-rails - PG::UndefinedTable: 错误:关系 "events"不存在

转载 作者:行者123 更新时间:2023-11-29 13:28:23 28 4
gpt4 key购买 nike

因此,我正在开发一个现有的应用程序,并且正在将其设置到我的本地环境中,但是我遇到了一些问题:

1. 我已经下载了最新的代码,并从内部开发人员那里转储了数据库。这是一个 .sql 文件,所以我使用了以下命令:

$psql -h localhost -U root -d thms_development < /Users/me/mypath/public.sql

2. 这似乎有效,但在整个转储过程中我会看到 奇怪的错误,如:

ERROR:  role "rails_staging" does not exist

NOTICE: table "bidding_plans" does not exist, skipping
DROP TABLE
ERROR: type "public.eh_allocation_plan_status" does not exist
LINE 6: "status" "public"."eh_allocation_plan_status" DEFAULT 'clos...
^
ERROR: relation "public.bidding_plans" does not exist
BEGIN
ERROR: relation "public.bidding_plans" does not exist
LINE 1: INSERT INTO "public"."bidding_plans" VALUES ('8204668e-ca65-...

和其他类似的。

3. 最后,当我启动应用程序并单击事件链接时,我 得到以下内容:

Started GET "/api/v2/client_events/events_for_venue?venue_id=7d72f8d9-f39f-4ed6-a24e-fb1cf23bd62e" for 127.0.0.1 at 2015-03-18 19:49:40 -0400
Processing by Api::V2::ClientEventsController#events_for_venue as JSON
Parameters: {"venue_id"=>"7d72f8d9-f39f-4ed6-a24e-fb1cf23bd62e"}
PG::UndefinedTable: ERROR: relation "events" does not exist
LINE 5: WHERE a.attrelid = '"events"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"events"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum

Completed 500 Internal Server Error in 8ms

PG::UndefinedTable - ERROR: relation "events" does not exist
LINE 5: WHERE a.attrelid = '"events"'::regclass
^
:

我已经运行了 db:setup,这与当前开发人员使用的代码和数据库完全相同,出了什么问题?

谢谢!!

最佳答案

您收到的第一个错误表明 SQL 文件包含以 rails_staging 用户身份运行某些东西的代码。您对此的解决方案是获取正确的 SQL 文件或将您的机器/数据库精确配置为生成该 SQL 文件的同事。

关于ruby-on-rails - PG::UndefinedTable: 错误:关系 "events"不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29134901/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com