Create database on postgres

I have a spring boot app that uses postgres.
For tests, I was using mysql, but since buddy added postgres service, I’m giving a try but I found that since hibernate do not create database, only tables, my tests will not pass.
MySQL have the option to add ?createDatabaseIfNotExist=true but thats not true with Postgres.
another option would be psql, but psql will hang and wait for password input.
would be nice if in the services we could define a database name to be created

hi @luizkowalski,

You can do that with this command: export PGPASSWORD=‘qwerty’; psql -h postgres -U postgres -c “CREATE DATABASE myDB”

since I’m running my tests in a Maven container, it does not have psql installed, and I think it is a overwork to install it just to create the database :frowning:

@luizkowalski I got your point, we’ve added the option to create a database to our backlog.
For now, you can do that in a way described above.

Just remember that if you add theese commands to Setup Commands:
apt-get update -y
apt-get install -y postgresql

the commands will be executed with the first build only. the next builds will be run as quickly as they used to.

@luizkowalski make sure to contact us at:, attach the link to this pipeline.
We may find another solution for you :slight_smile: