MAJOR ISSUE: New development machine; massive Liquibase errors

So I moved my main development machine from Windows to Linux. Grabbed the source of my applications from my Git repository and went to run them, and I’m getting massive amounts of Liquibase errors - note this was a migrated CUBA app.

Starting Liquibase at 12:23:43 (version 4.11.0 #2708 built at 2022-05-23 15:17+0000)
[2023-01-30 12:23:44] INFO [liquibase.database] Set default schema name to public
[2023-01-30 12:23:44] INFO [liquibase.lockservice] Successfully acquired change log lock
[2023-01-30 12:23:44] INFO [liquibase.changelog] Reading resource: com/medflex/mfmaint/liquibase/changelog/010-init-user.xml
[2023-01-30 12:23:44] INFO [liquibase.changelog] Reading resource: com/medflex/mfmaint/liquibase/changelog/2022/10/07-064350-7ccc05ee.xml
[2023-01-30 12:23:44] INFO [liquibase.changelog] Reading resource: com/medflex/mfmaint/liquibase/changelog/2022/10/12-080543-7ccc05ee.xml
[2023-01-30 12:23:44] INFO [liquibase.changelog] Reading resource: com/medflex/mfmaint/liquibase/changelog/2022/10/12-080849-7ccc05ee.xml
[2023-01-30 12:23:44] INFO [liquibase.changelog] Creating database history table with name: public.databasechangelog
[2023-01-30 12:23:44] INFO [liquibase.changelog] Reading from public.databasechangelog
Running Changeset: io/jmix/uidata/liquibase/changelog/001-ui-data.xml::1::ui-data
[2023-01-30 12:23:44] INFO [liquibase.changelog] Table UI_SETTING created
[2023-01-30 12:23:44] INFO [liquibase.changelog] ChangeSet io/jmix/uidata/liquibase/changelog/001-ui-data.xml::1::ui-data ran successfully in 18ms
Running Changeset: io/jmix/uidata/liquibase/changelog/001-ui-data.xml::2::ui-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Table UI_FILTER_CONFIGURATION created
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/uidata/liquibase/changelog/001-ui-data.xml::2::ui-data ran successfully in 16ms
Running Changeset: io/jmix/uidata/liquibase/changelog/001-ui-data.xml::3::ui-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Columns SYS_TENANT_ID(varchar(255)) added to UI_FILTER_CONFIGURATION
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/uidata/liquibase/changelog/001-ui-data.xml::3::ui-data ran successfully in 4ms
Running Changeset: io/jmix/uidata/liquibase/changelog/001-ui-data.xml::4::ui-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Columns NAME(varchar(255)),DEFAULT_FOR_ALL(boolean) added to UI_FILTER_CONFIGURATION
[2023-01-30 12:23:45] INFO [liquibase.changelog] Column UI_FILTER_CONFIGURATION.CODE renamed to CONFIGURATION_ID
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/uidata/liquibase/changelog/001-ui-data.xml::4::ui-data ran successfully in 4ms
Running Changeset: io/jmix/securitydata/liquibase/changelog/001-security-data.xml::1::security-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Table SEC_RESOURCE_ROLE created
[2023-01-30 12:23:45] INFO [liquibase.changelog] Table SEC_ROW_LEVEL_ROLE created
[2023-01-30 12:23:45] INFO [liquibase.changelog] Table SEC_RESOURCE_POLICY created
[2023-01-30 12:23:45] INFO [liquibase.changelog] Table SEC_ROW_LEVEL_POLICY created
[2023-01-30 12:23:45] INFO [liquibase.changelog] Table SEC_ROLE_ASSIGNMENT created
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/securitydata/liquibase/changelog/001-security-data.xml::1::security-data ran successfully in 75ms
Running Changeset: io/jmix/securitydata/liquibase/changelog/001-security-data.xml::2-postgresql::security-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Index IDX_RESOURCE_ROLE_UN_C created
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/securitydata/liquibase/changelog/001-security-data.xml::2-postgresql::security-data ran successfully in 10ms
Running Changeset: io/jmix/securitydata/liquibase/changelog/001-security-data.xml::3-postgresql::security-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Index IDX_ROW_LEVEL_ROLE_UN_C created
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/securitydata/liquibase/changelog/001-security-data.xml::3-postgresql::security-data ran successfully in 9ms
Running Changeset: io/jmix/securitydata/liquibase/changelog/001-security-data.xml::4::security-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Table persistent_logins created
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/securitydata/liquibase/changelog/001-security-data.xml::4::security-data ran successfully in 10ms
Running Changeset: io/jmix/securitydata/liquibase/changelog/002-security-data.xml::1::security-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Columns DESCRIPTION(text) added to SEC_RESOURCE_ROLE
[2023-01-30 12:23:45] INFO [liquibase.changelog] Columns DESCRIPTION(text) added to SEC_ROW_LEVEL_ROLE
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/securitydata/liquibase/changelog/002-security-data.xml::1::security-data ran successfully in 4ms
Running Changeset: io/jmix/securitydata/liquibase/changelog/002-security-data.xml::2::security-data
[2023-01-30 12:23:45] INFO [liquibase.changelog] Columns SCOPES(varchar(1000)) added to SEC_RESOURCE_ROLE
[2023-01-30 12:23:45] INFO [liquibase.changelog] ChangeSet io/jmix/securitydata/liquibase/changelog/002-security-data.xml::2::security-data ran successfully in 3ms
Running Changeset: com/haulmont/cuba/liquibase/changelog/002-migrate-security.xml::10::migrator
[2023-01-30 12:23:45] INFO [liquibase.lockservice] Successfully released change log lock
Unexpected error running Liquibase: Migration failed for change set com/haulmont/cuba/liquibase/changelog/002-migrate-security.xml::10::migrator:
     Reason: liquibase.exception.DatabaseException: ERROR: relation "public.sec_user" does not exist [Failed SQL: (0) ALTER TABLE public.SEC_USER ADD USERNAME VARCHAR(255)]
For more information, please use the --logLevel flag
[2023-01-30 12:23:45] SEVERE [liquibase.integration] Unexpected error running Liquibase: Migration failed for change set com/haulmont/cuba/liquibase/changelog/002-migrate-security.xml::10::migrator:
     Reason: liquibase.exception.DatabaseException: ERROR: relation "public.sec_user" does not exist [Failed SQL: (0) ALTER TABLE public.SEC_USER ADD USERNAME VARCHAR(255)]
liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set com/haulmont/cuba/liquibase/changelog/002-migrate-security.xml::10::migrator:
     Reason: liquibase.exception.DatabaseException: ERROR: relation "public.sec_user" does not exist [Failed SQL: (0) ALTER TABLE public.SEC_USER ADD USERNAME VARCHAR(255)]
	at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:126)
	at liquibase.Liquibase.lambda$null$0(Liquibase.java:265)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.Scope.child(Scope.java:243)
	at liquibase.Liquibase.lambda$update$1(Liquibase.java:264)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.Liquibase.runInScope(Liquibase.java:2405)
	at liquibase.Liquibase.update(Liquibase.java:211)
	at liquibase.Liquibase.update(Liquibase.java:197)
	at liquibase.integration.commandline.Main.doMigration(Main.java:1869)
	at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:398)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.integration.commandline.Main$1.run(Main.java:397)
	at liquibase.integration.commandline.Main$1.run(Main.java:221)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.integration.commandline.Main.run(Main.java:221)
	at liquibase.integration.commandline.Main.main(Main.java:164)
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set com/haulmont/cuba/liquibase/changelog/002-migrate-security.xml::10::migrator:
     Reason: liquibase.exception.DatabaseException: ERROR: relation "public.sec_user" does not exist [Failed SQL: (0) ALTER TABLE public.SEC_USER ADD USERNAME VARCHAR(255)]
	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:696)
	at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:56)
	at liquibase.changelog.ChangeLogIterator$2.lambda$null$0(ChangeLogIterator.java:113)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.changelog.ChangeLogIterator$2.lambda$run$1(ChangeLogIterator.java:112)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.Scope.child(Scope.java:243)
	at liquibase.changelog.ChangeLogIterator$2.run(ChangeLogIterator.java:93)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.Scope.child(Scope.java:243)
	at liquibase.Scope.child(Scope.java:247)
	at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:65)
	... 26 more
Caused by: liquibase.exception.DatabaseException: ERROR: relation "public.sec_user" does not exist [Failed SQL: (0) ALTER TABLE public.SEC_USER ADD USERNAME VARCHAR(255)]
	at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:397)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:83)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:151)
	at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1279)
	at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1261)
	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:661)
	... 46 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.sec_user" does not exist
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:329)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:315)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:291)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:286)
	at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:393)
	... 51 more

Advice as to how to fix this? jmix.liquibase.contexts is set to cuba (and always was)…

Hi, from what I can see from this log: “relation “public.sec_user” does not exist”
It says that a table containing users doesn’t exist.
You can easily fix that by creating that table, I would use IntelliJ database tools, even maybe copy the data.
Also, there must be a way to edit liquibase changelog and add that table to be created.

Kind regards,
Mladen

LOL - it should get created automatically, since this is a new machine with a totally empty database.

See Migration from CUBA Platform :: Jmix Documentation point 14