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

Liquidbase failing to migrate database schema #649

Open
johnaohara opened this issue Sep 18, 2023 · 2 comments
Open

Liquidbase failing to migrate database schema #649

johnaohara opened this issue Sep 18, 2023 · 2 comments
Labels
branch/master The master branch type/bug Something isn't working

Comments

@johnaohara
Copy link
Member

At startup liquidbase is failing to validate the changelog.xml;

2023-09-18 10:58:06,134 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile [dev]): java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:113)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: Error starting Liquibase
	at io.quarkus.liquibase.runtime.LiquibaseRecorder.doStartActions(LiquibaseRecorder.java:88)
	at io.quarkus.deployment.steps.LiquibaseProcessor$startLiquibase1744275855.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.LiquibaseProcessor$startLiquibase1744275855.deploy(Unknown Source)
	... 13 more
Caused by: liquibase.exception.CommandExecutionException: liquibase.exception.ValidationFailedException: Validation Failed:
     33 changesets check sum
          db/changeLog.xml::0::rvansa was: 8:ecf014ea1bae56b96ab069e7a50ccb19 but is now: 8:632debb79954a914baa2f2ba8b09fd2f
          db/changeLog.xml::1::rvansa was: 8:7845bc5946045a3ad85af3c41243739b but is now: 8:0308c7ee6d66919523bb66c720d210d9
          db/changeLog.xml::3::rvansa was: 8:6884290e279ad97d16f5df939802a29b but is now: 8:e7e810b539c49370ae23def7f25b0546
          db/changeLog.xml::4::rvansa was: 8:a7fc1a228e3b6ab7575eed12f98df5ef but is now: 8:8e0fcb2194785a9bab602693355207a3
          db/changeLog.xml::5::rvansa was: 8:6acf5a82c9b06ae4f2d7518a19ec32a1 but is now: 8:7ca63e32aaa993fef7ab954c13d542e4
          db/changeLog.xml::7::rvansa was: 8:c44e914bab1db9ba05c722067e3dbd47 but is now: 8:9dafd399bc8935ea65dc5f71c130c6d6
          db/changeLog.xml::8::rvansa was: 8:f14d9afb4145c304f67cce9d76f0c070 but is now: 8:7a61b8f4b125dec5b4cfdaffd4ecde1c
          db/changeLog.xml::12::rvansa was: 8:e4a168b061a2ba0d122aab21f2377eda but is now: 8:0831c1190443e231121887bd7277ddd8
          db/changeLog.xml::19::rvansa was: 8:b61bedb098da309b13e7c3313c0f1060 but is now: 8:57b4833aa222fb246b17d6b219134e0d
          db/changeLog.xml::20::rvansa was: 8:4879744b30eb752702c8b96b0c8e6a31 but is now: 8:38cea19d0b9f3115cb319c5a429ce2c1
          db/changeLog.xml::21::rvansa was: 8:98270ed3526bb20055dcc5b4df720506 but is now: 8:35c1ce4ea936ed3251bea575d8b52150
          db/changeLog.xml::24::rvansa was: 8:6b03b1086ef271c0f6ff596fa6c6be70 but is now: 8:54734ae97850597fcd701512b5584545
          db/changeLog.xml::25::rvansa was: 8:629d2c2d0bfc452869e60538100fb1e7 but is now: 8:1cb71eb23875259afef168c18dfcb67c
          db/changeLog.xml::27::rvansa was: 8:1261e8669ccaf51a13338fe31303af77 but is now: 8:83d40bcb9fbfa3ea6968a7192ca40f6d
          db/changeLog.xml::33::rvansa was: 8:6317e64ade28c97b799169e0fd235105 but is now: 8:2d09bef3e7a2c7187f4dfc82a80e5d4a
          db/changeLog.xml::34::rvansa was: 8:9cb8381de9104671ab7162134260707e but is now: 8:a1b43bf7b5abf6d8d41e2020f5e33233
          db/changeLog.xml::36::rvansa was: 8:bd31fd56480cc061d54283098d2c4708 but is now: 8:e8fd5b0b0ba9d46f5e0f30a656d33fe6
          db/changeLog.xml::39::rvansa was: 8:276dc95e4ef67d43541513ffa7cafb22 but is now: 8:6d1adc3952bb029f136f84d98f31904e
          db/changeLog.xml::47::rvansa was: 8:99bb1afaf94e231fab22d5cd34e7fdf2 but is now: 8:0f4017e1c9d72b4d45d1383a37b1eb17
          db/changeLog.xml::52::rvansa was: 8:ba34f4c36ae1f6fec06b1ed0a2041949 but is now: 8:cb36e858d9da7e9470909cd395d509b4
          db/changeLog.xml::53::jwhiting was: 8:9bd00b401a8c172c279a86010b748858 but is now: 8:2e1d1ce83054a6697a7930a86104744a
          db/changeLog.xml::54::rvansa was: 8:e3861ed7e68a19962feb0cf614cd7ee4 but is now: 8:be082ca084316aa42c5a9646b6b2c3d0
          db/changeLog.xml::59::jwhiting,rvansa was: 8:9466ccc6c07388a0c55342d0f49eeddb but is now: 8:5c1d28f359ba3f1f369d3ac5dca876ff
          db/changeLog.xml::60::rvansa was: 8:a0be02c36c68441465fc68e07a49d9ab but is now: 8:ba6844c300374c4a57f480f2e3739030
          db/changeLog.xml::65::rvansa was: 8:ffcf5d2919014f21a3e1d454269bd093 but is now: 8:de5198aa79b66e50d009e57009d058be
          db/changeLog.xml::67::rvansa was: 8:07b55cab6a7734a4a2ed41694f652873 but is now: 8:b9017fbfb643289b2d7f7ad6130febe7

	at liquibase.command.CommandScope.execute(CommandScope.java:236)
	at liquibase.Liquibase.validate(Liquibase.java:1303)
	at io.quarkus.liquibase.runtime.LiquibaseRecorder.doStartActions(LiquibaseRecorder.java:75)
	... 15 more
Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
     33 changesets check sum
          db/changeLog.xml::0::rvansa was: 8:ecf014ea1bae56b96ab069e7a50ccb19 but is now: 8:632debb79954a914baa2f2ba8b09fd2f
          db/changeLog.xml::1::rvansa was: 8:7845bc5946045a3ad85af3c41243739b but is now: 8:0308c7ee6d66919523bb66c720d210d9
          db/changeLog.xml::3::rvansa was: 8:6884290e279ad97d16f5df939802a29b but is now: 8:e7e810b539c49370ae23def7f25b0546
          db/changeLog.xml::4::rvansa was: 8:a7fc1a228e3b6ab7575eed12f98df5ef but is now: 8:8e0fcb2194785a9bab602693355207a3
          db/changeLog.xml::5::rvansa was: 8:6acf5a82c9b06ae4f2d7518a19ec32a1 but is now: 8:7ca63e32aaa993fef7ab954c13d542e4
          db/changeLog.xml::7::rvansa was: 8:c44e914bab1db9ba05c722067e3dbd47 but is now: 8:9dafd399bc8935ea65dc5f71c130c6d6
          db/changeLog.xml::8::rvansa was: 8:f14d9afb4145c304f67cce9d76f0c070 but is now: 8:7a61b8f4b125dec5b4cfdaffd4ecde1c
          db/changeLog.xml::12::rvansa was: 8:e4a168b061a2ba0d122aab21f2377eda but is now: 8:0831c1190443e231121887bd7277ddd8
          db/changeLog.xml::19::rvansa was: 8:b61bedb098da309b13e7c3313c0f1060 but is now: 8:57b4833aa222fb246b17d6b219134e0d
          db/changeLog.xml::20::rvansa was: 8:4879744b30eb752702c8b96b0c8e6a31 but is now: 8:38cea19d0b9f3115cb319c5a429ce2c1
          db/changeLog.xml::21::rvansa was: 8:98270ed3526bb20055dcc5b4df720506 but is now: 8:35c1ce4ea936ed3251bea575d8b52150
          db/changeLog.xml::24::rvansa was: 8:6b03b1086ef271c0f6ff596fa6c6be70 but is now: 8:54734ae97850597fcd701512b5584545
          db/changeLog.xml::25::rvansa was: 8:629d2c2d0bfc452869e60538100fb1e7 but is now: 8:1cb71eb23875259afef168c18dfcb67c
          db/changeLog.xml::27::rvansa was: 8:1261e8669ccaf51a13338fe31303af77 but is now: 8:83d40bcb9fbfa3ea6968a7192ca40f6d
          db/changeLog.xml::33::rvansa was: 8:6317e64ade28c97b799169e0fd235105 but is now: 8:2d09bef3e7a2c7187f4dfc82a80e5d4a
          db/changeLog.xml::34::rvansa was: 8:9cb8381de9104671ab7162134260707e but is now: 8:a1b43bf7b5abf6d8d41e2020f5e33233
          db/changeLog.xml::36::rvansa was: 8:bd31fd56480cc061d54283098d2c4708 but is now: 8:e8fd5b0b0ba9d46f5e0f30a656d33fe6
          db/changeLog.xml::39::rvansa was: 8:276dc95e4ef67d43541513ffa7cafb22 but is now: 8:6d1adc3952bb029f136f84d98f31904e
          db/changeLog.xml::47::rvansa was: 8:99bb1afaf94e231fab22d5cd34e7fdf2 but is now: 8:0f4017e1c9d72b4d45d1383a37b1eb17
          db/changeLog.xml::52::rvansa was: 8:ba34f4c36ae1f6fec06b1ed0a2041949 but is now: 8:cb36e858d9da7e9470909cd395d509b4
          db/changeLog.xml::53::jwhiting was: 8:9bd00b401a8c172c279a86010b748858 but is now: 8:2e1d1ce83054a6697a7930a86104744a
          db/changeLog.xml::54::rvansa was: 8:e3861ed7e68a19962feb0cf614cd7ee4 but is now: 8:be082ca084316aa42c5a9646b6b2c3d0
          db/changeLog.xml::59::jwhiting,rvansa was: 8:9466ccc6c07388a0c55342d0f49eeddb but is now: 8:5c1d28f359ba3f1f369d3ac5dca876ff
          db/changeLog.xml::60::rvansa was: 8:a0be02c36c68441465fc68e07a49d9ab but is now: 8:ba6844c300374c4a57f480f2e3739030
          db/changeLog.xml::65::rvansa was: 8:ffcf5d2919014f21a3e1d454269bd093 but is now: 8:de5198aa79b66e50d009e57009d058be
          db/changeLog.xml::67::rvansa was: 8:07b55cab6a7734a4a2ed41694f652873 but is now: 8:b9017fbfb643289b2d7f7ad6130febe7

	at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:344)
	at liquibase.command.core.helpers.DatabaseChangelogCommandStep.run(DatabaseChangelogCommandStep.java:95)
	at liquibase.command.CommandScope.execute(CommandScope.java:213)
	... 17 more
@johnaohara johnaohara added type/bug Something isn't working branch/master The master branch labels Sep 18, 2023
@johnaohara
Copy link
Member Author

I looks like we must disable validation t migration in order for updates to not fail to existing databases

It appears that this commit is causing the migration validation issues: db94518

@lampajr
Copy link
Member

lampajr commented Mar 14, 2024

Hey @johnaohara, I don't get why we are adding the <validCheckSum>ANY<validCheckSum> to any new changeSet, e.g.,

<changeSet id="119" author="johara">
<validCheckSum>ANY</validCheckSum>
<sql>
UPDATE changedetection
SET config=subquery.newConfig
FROM (select id as newID, jsonb_set(config, '{model}', to_jsonb(changedetection.model::text), true) as newConfig from changedetection) AS subquery
WHERE changedetection.id=subquery.newID;
</sql>
</changeSet>

(actually all changeSets have that field set)

IIRC there is no need to add that on new changeSets, just those that have been modified after migration happened should have it. am I wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/master The master branch type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants