Create Database with Liquibase

hi, do we have command to create database as first time creation of set up , detect if database not existing create it.

There isn’t a change-type to create a database. Liquibase assumes you have an existing database, with a existing user/password to connect, and the user has the appropriate privileges in the database to run the necessary sql.

I’m recommend starting here in the documentation:

thanks for response , appreciate it.

1 Like

Kusum, If you are looking for a way to create maven projects that can create a database you can look at the sqlexec plugin. GitHub - mojohaus/sql-maven-plugin: SQL Maven Plugin. It will allow you to write the native sql to create and drop databases in platform dependent ways. It won’t have the nice platform independent constructs that liquibase gives you.

Mssql specific comment, I think I also tried using <sql> commands in the master database, but I think Liquibase limits what you can do in a sql command to a system table because of the way it takes locks for rollback conflicts with the database creation.

thank you for the response , appreciate it . I will explore this.