Defect #38212

migrate

Added by Goran Hasse 8 days ago. Updated 6 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Database
Target version:-
Resolution: Affected version:5.0.4

Description

I try to install redmine-5.0.4 on FreeBSD 3.1-RELEASE and postgresql 15.1

Then I run

bash
RAILS_ENV=production bundle exec rake db:migrate

I get a permission error

rake aborted!
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR:  permission denied for schema public
LINE 1: CREATE TABLE "schema_migrations" ("version" character varyin...
                     ^
Caused by:
PG::InsufficientPrivilege: ERROR:  permission denied for schema public
LINE 1: CREATE TABLE "schema_migrations" ("version" character varyin...
                     ^
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

// GH

History

#1 Updated by Vincent Robert 6 days ago

  • Status changed from New to Closed

This problem is not related to the Redmine application, but to your PostgreSQL roles configuration. You may be using a pg user who has not enough privileges.
I think we can close the issue here.

#2 Updated by Goran Hasse 6 days ago

But in my opinion:

At the installation a role and a database owned by that role is
created.

The migrate scripts should take on that role. Read the config/database.yml or something.

Or at least there should be some instruction on how to take that role from the command line.

RAILS_ENV=production bundle exec rake db:migrate

// GH

#3 Updated by Goran Hasse 6 days ago

Maybe the commands in the installation manual is outdated

Example:

psql -U postgres -h localhost
psql (15.1)

postgres=# CREATE ROLE test3 LOGIN ENCRYPTED PASSWORD 'test123' NOINHERIT VALID UNTIL 'infinity';
CREATE ROLE

postgres=# create database test3 with encoding='UTF8' OWNER=test3;
CREATE DATABASE
postgres=# \q

gorhas@www:~ $ psql -U test3 -h localhost test3
psql (15.1)

test3=> create table demo( name varchar default '' );
ERROR:  permission denied for schema public
LINE 1: create table demo( name varchar default '' );
                     ^
test3=> 

If I do like this... it works

psql -U postgres -h localhost
psql (15.1)

postgres=# create user test4 with encrypted password 'test123';
CREATE ROLE

postgres=# create database test4 template default owner test4;
CREATE DATABASE

postgres=# \q

gorhas@www:~ $ psql -W -U test4 -h localhost test4
Password: 
psql (15.1)

test4=> create table demo( name varchar default '' );
CREATE TABLE
test4=> 

Also available in: Atom PDF