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

"includeAll" Pathing Differs in Deployed WAR #3260

Open
imperiouslol opened this issue Sep 8, 2022 · 2 comments
Open

"includeAll" Pathing Differs in Deployed WAR #3260

imperiouslol opened this issue Sep 8, 2022 · 2 comments

Comments

@imperiouslol
Copy link

Environment

Liquibase Version: 4.3.5

Liquibase Integration & Version: Gradle 7.1.1, Spring Boot 2.5.2

Liquibase Extension(s) & Version: Liquibase Groovy DSL 3.0.1

Database Vendor & Version: H2 1.3.174, Oracle 11G

Operating System Type & Version: Windows

Infrastructure Type/Provider: Websphere Application Server (prod environment), Tomcat (local development)

Description

When deploying locally (spring boot / tomcat), or running a local updateSQL task, my changeset file pathing for changesets under the includeAll tag differ from the file pathing that Liquibase uses in a deployed WAR file:

Relevant changelog-master tag:

  - includeAll:
      path: db/changelog/nonprod/changes/sqlscripts

Deployed WAR resource path:

WEB-INF/classes/db/changelog/local/changes/sqlscripts/liquibase-changelog-1.0.h2.sql

Local bootRun resource path:

db/changelog/local/changes/sqlscripts/liquibase-changelog-1.0.h2.sql

As a result of this, if I manually run the generated updateSQL script against the database, then deploy my application with Liquibase enabled, the changesets under includeAll are attempted again and the deployment fails due to the DB objects already existing.

Steps To Reproduce

  1. Create a Spring Boot / Gradle project
  2. Create a changeset file and add it to changelog-master under includeAll
  3. bootRun and check the logs or DB for the filename resource being referenced
  4. Deploy the application as a WAR and check the logs or DB for the filename resource being referenced
  5. Compare steps 3 and 4, as the pathing differs

Actual Behavior

Relevant Logging from local bootRun:

[DirectJDKLog.java:180] Initializing Spring embedded WebApplicationContext
l.lockservice [JavaLogger.java:23] Successfully acquired change log lock
l.changelog [JavaLogger.java:23] Reading resource: db/changelog/local/changes/sqlscripts/liquibase-changelog-1.0.h2.sql
l.changelog [JavaLogger.java:23] Creating database history table with name: MUNI.DATABASECHANGELOG
l.changelog [JavaLogger.java:23] Reading from MUNI.DATABASECHANGELOG

Relevant Logging from deployed WAR File to Websphere:

...
com.ibm.ws.webcontainer.webapp.WebApp log SRVE0292I: Servlet Message - [lgmm#lgmm.war]:.Initializing Spring embedded WebApplicationContext
liquibase.lockservice  Successfully acquired change log lock
liquibase.changelog  Reading resource: WEB-INF/classes/db/changelog/local/changes/sqlscripts/liquibase-changelog-1.0.h2.sql
liquibase.changelog  Reading from MUNI.DATABASECHANGELOG
...

The resource being read in for our changelog files under includeAll differs between the two environments. This is causing conflict when running our database script manually because this is what gets added to the DATABASECHANGELOG.FILENAME column.

Expected/Desired Behavior

The resource path being read in should be the same.

Additional Context

We're only experiencing this issue with changesets under includeAll

  - includeAll:
      path: 

include works as expected:

  - include:
      file:

It appears that DatabaseChangelog.includeAll is what's responsible for parsing this path, but I'm unsure why the pathing differs in the context of a deployed WAR.

Our only solution as of right now is to use include rather than includeAll, but we would prefer to use includeAll as our scripts underneath that location are generated automatically.

Please let me know if any additional information is needed, or if I'm misunderstanding / mis-using something.

@cah-renan-ferreira
Copy link

This is really annoying.
If someone runs locally to a shared database, like a dev env database, when the app is actually deployed, it tries to run the file again because it's a different path =/

@heryqk
Copy link

heryqk commented Apr 19, 2024

We’ve encountered this issue as well. Is there a planned resolution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Open Issues
Development

No branches or pull requests

5 participants