从 Macports 切换到 Homebrew 后,Rails 和 Postgres 并没有相处融洽; PGError:错误:无法识别的时区名称:“UTC”
我将 /opt/local
(Macports 的内容所在)中的所有内容都移至 ~/.macports
中。其中包括我的旧 postgres 数据库集群。
然后我使用 Homebrew 安装了 postgres 并运行了它告诉我的设置(在 /usr/local
中创建一个新的数据库集群)。
在我的项目中,我运行了 rake db:drop:all 和 rake db:create 。他们高高兴兴地干着自己的工作。
但是当我尝试rake db:migrate
时,postgres和rails发生冲突并告诉我
rake aborted!
PGError: ERROR: unrecognized time zone name: "UTC"
: SET time zone 'UTC'
我不知道他们在说什么。我发现 这篇关于 config.time_zone
bug 的文章稍微有启发性,但不足以找到我的方法。
谢谢!
I moved everything that I had in /opt/local
(where Macports' things lived) into ~/.macports
. That included my old postgres database cluster.
Then I installed postgres using Homebrew and ran the setup that it told me to (creating a new database cluster in /usr/local
).
In my project, I ran rake db:drop:all
and rake db:create
. These did their work cheerfully.
But when I tried to rake db:migrate
, postgres and rails fight and tell me
rake aborted!
PGError: ERROR: unrecognized time zone name: "UTC"
: SET time zone 'UTC'
I don't know what they're talking about, though. I found this article about a config.time_zone
bug slightly illuminating, but not enough to find my way.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我收到此错误,只需手动启动 postgres:
您也可以停止它:
I was getting this error and simply need to start postgres manually:
You can also stop it:
经过一番努力后,我通过运行解决了这个问题:
env ARCHFLAGS="-arch x86_64" gem install pg
After much head banging, I solved this problem by running:
env ARCHFLAGS="-arch x86_64" gem install pg
我不完全确定我是如何修复它的,但是卸载 Postgres 并重新安装它(并非常仔细地遵循它提供的安装说明)让它工作。
I'm not completely sure how I fixed it, but uninstalling Postgres and reinstalling it (and following the setup instructions it gives very carefully) got it working.