从 Macports 切换到 Homebrew 后,Rails 和 Postgres 并没有相处融洽; PGError:错误:无法识别的时区名称:“UTC”

发布于 2024-10-02 10:09:24 字数 715 浏览 1 评论 0原文

我将 /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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

明媚如初 2024-10-09 10:09:24

我收到此错误,只需手动启动 postgres:

  pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

您也可以停止它:

pg_ctl -D /usr/local/var/postgres stop -s -m fast

I was getting this error and simply need to start postgres manually:

  pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

You can also stop it:

pg_ctl -D /usr/local/var/postgres stop -s -m fast
吃→可爱长大的 2024-10-09 10:09:24

经过一番努力后,我通过运行解决了这个问题:

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

七婞 2024-10-09 10:09:24

我不完全确定我是如何修复它的,但是卸载 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文