buffalo: Create / drop database not working

Hi there,

Thanks for your work, at first 😃 I ran into problems just executing the following command: $ buffalo create db -a OR

$ buffalo db drop -a

I have the following database.yml:

development:
  dialect: postgres
  database: myAppdb
  user: user
  password: password
  host: 127.0.0.1
  pool: 5

test:
  url: {{envOr "TEST_DATABASE_URL" "postgres://user:password@127.0.0.1:5432/myApp_test?sslmode=disable"}}

production:
  url: {{envOr "DATABASE_URL" "postgres://user:password@127.0.0.1:5432/myApp_production?sslmode=disable"}}

I get:

$ buffalo db drop -a
v3.41.3

couldn't drop database myApp_test: error dropping PostgreSQL database myApp_test: pq: authentification par mot de passe échouée pour l'utilisateur  « user »
couldn't drop database myApp_production: error dropping PostgreSQL database myApp_production: pq: authentification par mot de passe échouée pour l'utilisateur  « user »
couldn't drop database myAppdb: error dropping PostgreSQL database myAppdb: pq: la base de données « user » n'existe pas

Meaning: buffalo seems to understand postgres://user:password as postgres://DATABASEr:password !

Any help, please ?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I have found work around:

  1. Create the database called what ever your postgres username is:
createdb my_postgres_username
  1. run the buffalo command to create the database:
buffalo db create -a

And on my machine it completed, hopefully it will on yours

Not sure if this is related but it’s not working for me either, only the error doesn’t make sense:

ERRO[0000] Error: couldn’t create database vuerecipe: error creating PostgreSQL database vuerecipe: pq: database “robvdl” does not exist

What doesn’t make sense in the error is that “robvdl” is not my db name, it’s my username, so why it is saying “database robvdl does not exist” is beyond me, the db name is “vuerecipe” and username “robvdl”.

I am getting the same error when doing a buffalo db drop.

buffalo db drop -a

I have made sure the robvdl user can log in with password and has createdb privileges, so not sure, this should be working.

If i manually create the databases and run buffalo db migrate it’s fine and creates tables, it just seems to have issues creating databases and dropping them.