Search code examples
postgresqldatabase-schemaliquibase

Liquibase: How to change default postgresql schema


By default liquibase create all objects on the public schema. However I created another schema and I want liquibase to use it.

I changed database URL by appending searchpath=mySchema

jdbc:postgresql://${host}:${db.port}/${db.name}?searchpath=mySchema

I also tried appending it with currentSchema=mySchema

jdbc:postgresql://${dbhost}:${db.port}/${db.name}?currentSchema=mySchema

but it both ways liquibase is still pointing into public schema.

Any help is appreciated..


Solution

  • You can try to change PG user account so that the right default schema is set at database connection time with something like:

    alter role r in database b set search_path='s';