Hi team,
I’m facing an issue using generateChangeLog
with PostgreSQL (Liquibase 4.32.0, Community Edition), where Liquibase fails to include the schemaName
attribute in the generated changelog, even when multiple schemas are involved and schema scoping is configured properly.
❯ Context:
I’m working with a PostgreSQL database that uses multiple application schemas (not just public
). I generate baselines using generateChangeLog
per schema and then include them in a master changelog. The goal is to version-control each schema cleanly.
However, when I attempt to rebuild the database from scratch using liquibase update
, all objects are created in the public
schema, despite having originally belonged to other schemas like documentvault
, usermanagement
, etc.
This happens because Liquibase omits the schemaName
field entirely in the generated changelog, and during update, it defaults to creating objects in public
.
❯ Environment:
- Liquibase version: 4.32.0 (Community Edition)
- PostgreSQL version: 14 (AWS RDS)
- Output format: YAML (also tested with SQL)
- Execution method: CLI (shell script using
liquibase generateChangeLog
) - OS: Ubuntu (WSL 2)
❯ liquibase.properties (sanitized):
properties
liquibase.command.url=jdbc:postgresql://<host>:5432/<db>?searchpath=__none__
liquibase.command.username=<user>
liquibase.command.password=***
defaultSchemaName=__none__
searchPath:
liquibaseSchemaName=liquibase_control
❯ Command used:
liquibase \
--defaultsFile=liquibase.properties \
--schemas=documentvault \
--changeLogFile=baseline.yaml \
generateChangeLog
❯ Output example:
yaml
- createTable:
tableName: vault
columns:
...
Expected output:
yaml
- createTable:
schemaName: documentvault
tableName: vault
...
❯ What I’ve tried:
- Using
--schemas=<schema>
correctly - Setting
defaultSchemaName
to a non-existent placeholder (e.g.,__none__
) - Explicitly setting
searchPath:
as blank - Appending
?searchpath=__none__
or?currentSchema=liquibase_control
to the JDBC URL - Verifying that the user has no default schema set or
search_path
configured - Running Liquibase from a clean Docker container
Despite all this, Liquibase still omits the schemaName
in changelog generation, which completely breaks restore operations for multi-schema environments.
❯ Question:
Is there a way to guarantee that Liquibase always includes the schemaName
in each createTable
, createIndex
, etc., without having to post-process the changelog manually?
Any insight or workaround would be greatly appreciated. Thank you!