1

I am using the following command to generate the change log

liquibase --schemas=test_schema --changelog-file=changelog.xml generateChangeLog

My liquibase.properties file is following:

url: jdbc:postgresql://xx.xxx.xx.xx:5432/test_db
driver: org.postgresql.Driver
username: testuser
password: test
logFile: liquibase.log
logLevel: debug
defaultSchemaName= test_schema
outputDefaultSchema= true

The output in the changelog.xml doesnt have a schemaName, I have multiple schemas in my database so I need schemaname in the changelog as well.

Output :

<changeSet author="user1 (generated)" id="xxxxxxxxxxxxx-1">
        <createTable tableName="hello_world">
            <column name="msg" type="CHAR(60)"/>
        </createTable>
    </changeSet>

Should be test_schema.hello_world or schemaname should be defined. Any suggestions what I am doing wrong?

Sam
  • 161
  • 1
  • 9

2 Answers2

2

Try to append currentSchema= to your db url

e.g. command line:

--url="jdbc:postgresql://DB_HOST:DB_PORT/DB_NAME?currentSchema=SCHEMA_NAME"

liquibase.properties

url="jdbc:postgresql://DB_HOST:DB_PORT/DB_NAME?currentSchema=SCHEMA_NAME"

then call

liquibase <other command line params not part of liquibae.properties> generateChangeLog
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 27 '21 at 21:11
  • Yes I forgot to update the question, this approach already solved my problem hence upvoting it :) – Sam Nov 04 '21 at 08:17
0

According to this doc, the --schemas=<name1, name2> specifies database schemas you want to include. You might want to list out the schemas you want to include. Or you can simply use the liquibase --changeLogFile=dbchangelog.xml generateChangeLog command.

Aditi
  • 357
  • 1
  • 7