Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update command of Liquibase version > 4.20.0 not working with change log table name other than DATABASECHANGELOG #4465

Open
1 of 2 tasks
bwonisch opened this issue Jul 4, 2023 · 2 comments

Comments

@bwonisch
Copy link

bwonisch commented Jul 4, 2023

Search first

  • I searched and no similar issues were found

Description

We operate multiple application in a single database. The database is upgraded using Liquibase with each application having it's own change log table.

Starting with Liquibase version > 4.20.0, the update command is no longer working with change log table name other than DATABASECHANGELOG.
The update command does ignore the parameter databaseChangeLogTableName or the environment variable LIQUIBASE_CHANGELOG_TABLENAME.

Steps To Reproduce

  1. Apply database changes using Liquibase's update command with parameter databaseChangeLogTableName or environment variable LIQUIBASE_CHANGELOG_TABLENAME. Use Liquibase version 4.20.0
  2. Upgrade Liquibase to a version > 4.20.0 (for example 4.21.1 or 4.23.0)
  3. Run another update command with the new Liquibase version

After the upgrade of the Liquibase version, the parameter databaseChangeLogTableName is ignored, and the change log is verified against/written to the default change log table DATABASECHANGELOG.

Please use the following commands to reproduce the issue:

  1. Liquibase 4.20.0, Application 1 (Default change log table)

liquibase.sh \ --url=jdbc:postgresql://localhost:5432/db \ --changeLogFile=config.xml \ --username='sys' \ --password='password' \ --contexts=APPS \ --logLevel=WARN \ update

  1. Liquibase 4.20.0, Application 2 (Name of change log table provided)

liquibase.sh \ --url=jdbc:postgresql://localhost:5432/db \ --changeLogFile=config.xml \ --username='sys' \ --password='password' \ --contexts=APPS \ --databaseChangeLogTableName=DATABASECHANGELOG_APP2 \ --databaseChangeLogLockTableName=DATABASECHANGELOGLOCK_APP2 \ --logLevel=WARN \ update

  1. Upgrade Liquibase to a version > 4.20.0 (for example 4.21.1 or 4.23.0)

  2. Liquibase 4.21.1 or 4.23.0, Application 1 (Default change log table)

liquibase.sh \ --url=jdbc:postgresql://localhost:5432/db \ --changeLogFile=config.xml \ --username='sys' \ --password='password' \ --contexts=APPS \ --logLevel=WARN \ update

  1. Liquibase 4.21.1 or 4.23.0, Application 2 (Name of change log table provided)

liquibase.sh \ --url=jdbc:postgresql://localhost:5432/db \ --changeLogFile=config.xml \ --username='sys' \ --password='password' \ --contexts=APPS \ --databaseChangeLogTableName=DATABASECHANGELOG_APP2 \ --databaseChangeLogLockTableName=DATABASECHANGELOGLOCK_APP2 \ --logLevel=WARN \ update

Expected/Desired Behavior

Liquibase uses the change log according to parameter databaseChangeLogTableName or environment variable LIQUIBASE_CHANGELOG_TABLENAME.

Liquibase Version

4.21.1

Database Vendor & Version

PostgreSQL 14.5

Liquibase Integration

CLI

Liquibase Extensions

No response

OS and/or Infrastructure Type/Provider

No response

Additional Context

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)
@wwillard7800
Copy link
Contributor

wwillard7800 commented Jul 4, 2023

Referring to the docs:

https://docs.liquibase.com/parameters/home.html

The environment variable names should be LIQUIBASE_DATABASE_CHANGELOG_TABLE_NAME and LIQUIBASE_DATABASE_CHANGELOG_LOCK_TABLE_NAME. Can you try it again with those spellings?

Also, this command line worked for me:

liquibase --url=jdbc:postgresql://localhost:6432/intuserdb --changeLogFile=simple-changelog.xml --databaseChangeLogTableName=DATABASECHANGELOG_APP2 --databaseChangeLogLockTableName=DATABASECHANGELOGLOCK_APP2 --username=proschema --password='proschema' --logLevel=WARN update

`bash-5.0$ psql -U proschema intuserdb
psql (11.5)
Type "help" for help.

intuserdb=> \dt
List of relations
Schema | Name | Type | Owner
------------------+--------------------------------------------+----------+-----------
proschema | databasechangelog_app2 | table | proschema
proschema | databasechangeloglock_app2 | table | proschema
proschema | mc_tbl | table | proschema
(3 rows)

intuserdb=>
`

I am running with version 4.21.1

@kevin-atx
Copy link
Contributor

@bwonisch - I'm checking back to see if the information provided by @wwillard7800 addressed your issue. Please let us know when you get a chance. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Discussion
Development

No branches or pull requests

3 participants