所以,我正在开发一个现有应用,我正在设置本地环境,但是我遇到了一些问题:
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,这是当前开发人员正在使用的完全相同的代码和数据库,出了什么问题?
谢谢!
答案 0 :(得分:1)
您收到的第一个错误表明SQL文件包含以rails_staging
用户身份运行某些内容的代码。您对此的解决方法是获取正确的SQL文件或精确配置您的机器/ DB作为生成该SQL文件的同事。