I’m running into a problem when I try to execute the following scenario.
- Create a Liquibase project using Liquibase 1.9.5.
- Run Liquibase against a blank database with the initial changelog file that. Run all refactorings immediately (analogous to the 'update' command).
- Add new changesets to the changelog file.
- Upgrade to Liquibase 2.0
- Run Liquibase against the database, but output the refactorings to file (analogous to the 'updateSQL' command).
When I attempt to walk through that scenario, I get an error that the “orderexecuted” column doesn’t exist in DatabaseChangelog. It looks like what is happening is that Liquibase is dumping the changes necessary to DatabaseChangelog to the sql output file, but then attempting to read data from that column farther on in its operations.
Other than running a dummy changelog file directly against the database to keep the createUpdateScript method from failing later on, is there a good workaround for this?
-
Exception in thread "main" liquibase.exception.DatabaseException: Error executing SQL SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=ORDEREXECUTED, DRIVER=3.57.82
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:143)
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:151)
at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:203)
at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:198)
at liquibase.executor.LoggingExecutor.queryForList(LoggingExecutor.java:156)
at liquibase.database.AbstractDatabase.getRanChangeSetList(AbstractDatabase.java:852)
at liquibase.database.AbstractDatabase.checkDatabaseChangeLogTable(AbstractDatabase.java:440)
at liquibase.Liquibase.checkDatabaseChangeLogTable(Liquibase.java:535)
at liquibase.Liquibase.update(Liquibase.java:108)
at liquibase.Liquibase.update(Liquibase.java:144)
at com.docfinity.util.LiquibaseDBUpdater.createUpdateScript(LiquibaseDBUpdater.java:197)
at com.docfinity.util.LiquibaseDBUpdater.main(LiquibaseDBUpdater.java:169)
Caused by: com.ibm.db2.jcc.am.io: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=ORDEREXECUTED, DRIVER=3.57.82
at com.ibm.db2.jcc.am.bd.a(bd.java:676)
at com.ibm.db2.jcc.am.bd.a(bd.java:60)
at com.ibm.db2.jcc.am.bd.a(bd.java:127)
at com.ibm.db2.jcc.am.km.c(km.java:2506)
at com.ibm.db2.jcc.am.km.d(km.java:2483)
at com.ibm.db2.jcc.am.km.a(km.java:1963)
at com.ibm.db2.jcc.t4.db.g(db.java:139)
at com.ibm.db2.jcc.t4.db.a(db.java:39)
at com.ibm.db2.jcc.t4.t.a(t.java:32)
at com.ibm.db2.jcc.t4.sb.h(sb.java:135)
at com.ibm.db2.jcc.am.km.eb(km.java:1934)
at com.ibm.db2.jcc.am.km.a(km.java:2863)
at com.ibm.db2.jcc.am.km.a(km.java:628)
at com.ibm.db2.jcc.am.km.executeQuery(km.java:612)
at liquibase.executor.jvm.JdbcExecutor$1QueryStatementCallback.doInStatement(JdbcExecutor.java:129)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
... 12 more
I have reproduced this against DB2 and MS-SQL. Included below is a stack trace from DB2.