耙子中止!错误:必须是数据库的所有者 [英] rake aborted! ERROR: must be owner of database

查看:59
本文介绍了耙子中止!错误:必须是数据库的所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 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;

这篇关于耙子中止!错误:必须是数据库的所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆