Home:ALL Converter>Liquibase: How to change default postgresql schema

Liquibase: How to change default postgresql schema

Ask Time:2020-03-10T22:18:16         Author:dani

Json Formatter

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..

Author:dani,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/60619504/liquibase-how-to-change-default-postgresql-schema
Vaclav Bartacek :

You have to instruct Liquibase to create its meta tables DATABASECHANGELOG and DATABASECHANGELOCK in your schema as well. Just put the following line into your Liquibase properties file:\nliquibaseSchemaName=mySchema\n\nSee also https://docs.liquibase.com/workflows/liquibase-community/creating-config-properties.html",
2022-01-18T11:26:34
pifor :

You can try to change PG user account so that the right default schema is set at database connection time with something like:\n\nalter role r in database b set search_path='s';\n",
2020-03-10T14:50:18
yy