耙子中止!错误:必须是数据库的所有者

编程入门 行业动态 更新时间:2024-10-24 04:37:10
本文介绍了耙子中止!错误:必须是数据库的所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在学习 Michael Hartl 出色的教程,但在尝试时使用以下命令准备测试数据库:捆绑执行耙 db:test:prepare我收到此错误消息:

I am working through Michael Hartl's excellent tutorial but when trying to prepare the test database with the command: bundle exec rake db:test:prepare I get this error message:

错误:必须是数据库 sample_app_test 的所有者...

ERROR: must be owner of database sample_app_test...

我在使用开发数据库时从未得到过,因为我为 Rails 应用程序创建了以下数据库角色:

which I never got when using the development database, because I had created the following database role for my Rails app:

使用 CREATEDB 登录创建角色 demo_app

CREATE ROLE demo_app WITH CREATEDB LOGIN

(这是使用 Postgresql)

(this is using Postgresql)

有谁明白为什么这在测试环境中失败了?TIA...

Does anyone understand why this is failing in the test environment? TIA...

推荐答案

您是否确保了测试数据库的所有权?尝试在 Postgres 控制台客户端上运行 \l 命令并检查所有权.您还可以尝试以下查询:

Did you ensure the ownership of the test DB? try running the \l command on Postgres console client and check the ownerships. you can also try the following query:

ALTER DATABASE sample_app_test OWNER TO demo_app;

更多推荐

耙子中止!错误:必须是数据库的所有者

本文发布于:2023-10-15 02:45:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1493014.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:耙子   所有者   错误   数据库

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!