permission denied for schema public on stork-tool db-init
stork-tool db-create
works, but the db-init
command that follows, fails for me:
$ stork-tool db-init
INFO[2022-11-09 18:20:24] connection.go:75 Checking connection to database
FATA[2022-11-09 18:20:24] main.go:218 problem migrating database: ERROR #42501 permission denied for schema public
EXIT 1
I'm able to work around it with the following sequence:
$ stork-tool db-create
$ sudo -u postgres psql -d stork -c 'GRANT ALL PRIVILEGES ON SCHEMA public TO stork;'
$ stork-tool db-init
I'm using a dockerized PostgreSQL that comes by default with the following authentication setup. I don't know if it's relevant.
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
Suggesting that the GRANT ALL PRIVILEGES
command is added to the existing set of commands that are run with db-create
.