0
只需使用Sybase測試Liquibase 3.5.1,並發現我在創建第一個表後發現異常,並且liquibase嘗試更新DATABASECHANGELOG。DEPLOYMENT_ID不是爲DATABASECHANGELOG中的Sybase創建的,liquibase 3.5.1
我的研究似乎表明,新的DEPLOYMENT_ID列未在CreateDatabaseChangeLogTableGeneratorSybase
@Override
public Sql[] generateSql(CreateDatabaseChangeLogTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
return new Sql[] {
new UnparsedSql("CREATE TABLE " + database.escapeTableName(database.getLiquibaseCatalogName(), database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName()) + " (ID VARCHAR(150) NOT NULL, " +
"AUTHOR VARCHAR(150) NOT NULL, " +
"FILENAME VARCHAR(255) NOT NULL, " +
"DATEEXECUTED " + DataTypeFactory.getInstance().fromDescription("datetime", database).toDatabaseDataType(database) + " NOT NULL, " +
"ORDEREXECUTED INT NOT NULL, " +
"EXECTYPE VARCHAR(10) NOT NULL, " +
"MD5SUM VARCHAR(35) NULL, " +
"DESCRIPTION VARCHAR(255) NULL, " +
"COMMENTS VARCHAR(255) NULL, " +
"TAG VARCHAR(255) NULL, " +
"LIQUIBASE VARCHAR(20) NULL, " +
"CONTEXTS VARCHAR(255) NULL, " +
"LABELS VARCHAR(255) NULL, " +
"PRIMARY KEY(ID, AUTHOR, FILENAME))",
getAffectedTable(database))
}; //To change body of implemented methods use File | Settings | File Templates.
,它獲得創建該表添加確實缺少DEPLOYMENT_ID:
DROP TABLE dbo.MCH_DATABASE_CHANGE_LOG;
CREATE TABLE dbo.DATABASECHANGELOG
(
ID varchar(150) NOT NULL,
AUTHOR varchar(150) NOT NULL,
FILENAME varchar(255) NOT NULL,
DATEEXECUTED datetime NOT NULL,
ORDEREXECUTED int NOT NULL,
EXECTYPE varchar(10) NOT NULL,
MD5SUM varchar(35),
DESCRIPTION varchar(255),
COMMENTS varchar(255),
TAG varchar(255),
LIQUIBASE varchar(20),
CONTEXTS varchar(255),
LABELS varchar(255)
);
我是例外得到:
Caused by: liquibase.exception.DatabaseException: Invalid column name 'DEPLOYMENT_ID'.
[Failed SQL: INSERT INTO [dbo].[MTA_DATABASE_CHANGE_LOG] ([ID], [AUTHOR], [FILENAME], [DATEEXECUTED], [ORDEREXECUTED], [MD5SUM], [DESCRIPTION], [COMMENTS], [EXECTYPE], [CONTEXTS], [LABELS], [LIQUIBASE], [DEPLOYMENT_ID]) VALUES ('create-message-table', 'TAA.team', 'com/mcorp/tools/integration/persistence/liquibase/MTA.db.changelog-create.xml', GETDATE(), 1, '7:7fd70289c6cfc92aa9a8b2206743f4bf', 'createTable tableName=MTA_MESSAGES; sql', '', 'EXECUTED', 'table', NULL, '3.5.1', '7855321615')]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:301)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:107)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:97)
at liquibase.changelog.StandardChangeLogHistoryService.setExecType(StandardChangeLogHistoryService.java:341)
at liquibase.database.AbstractJdbcDatabase.markChangeSetExecStatus(AbstractJdbcDatabase.java:1134)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:62)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:79)
at liquibase.Liquibase.update(Liquibase.java:214)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.Liquibase.update(Liquibase.java:188)
at com.mcorp.tools.integration.persistence.liquibase.LiquibaseExecutor.execute(LiquibaseExecutor.java:195)
... 34 more
Caused by: java.sql.SQLException: Invalid column name 'DEPLOYMENT_ID'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2893)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2335)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:638)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:809)
at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1282)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:299)
... 45 more
我提出: https://liquibase.jira.com/browse/CORE-2818 我說我修補的生成器類與我的版本現在可以作爲解決方法運行。 ,剛剛發現了另一個與3.5.1和Sybase相關的bug,並提出: https://liquibase.jira.com/browse/CORE-2819 – consultantleon