Liquibase:如何禁用FILENAME列检查? [英] Liquibase: How to disable FILENAME column check?
问题描述
对于我们的应用程序,我们使用liquibase,可能需要从命令行(手动在生产环境中)运行数据库迁移,并且需要在应用程序启动时(测试环境等)自动运行数据库迁移.
For our application we liquibase and may have a need to run DB migrations both from command line (manually on production) AND automatically as the application starts up (test environment etc).
问题是 Liquibase 将整个文件名视为变更集标识的一部分,因此如果路径不同,它会尝试重新应用变更集.例如,对于完全限定路径"与到db-changelog文件的相对路径".
The problem is that Liquibase considers the whole filename as a portion of a changeSet's identity, therefore it tries to reapply the changesets if the path is different. For example, in case of "fully qualified path" VS "relative path" to to the db-changelog file.
如何禁用FILENAME列检查?
How to disable FILENAME column check?
推荐答案
基于始终在databaseChangeLog元素和每个changeSet元素上都使用逻辑文件路径属性.
Always use the logicalFilePath attribute on both the databaseChangeLog element and every changeSet element.
示例:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog logicalFilePath="does-not-matter" xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<changeSet logicalFilePath="path-independent" author="authorId" id="1">
...
</changeSet>
</databaseChangeLog>
结果,所有变更集的FILENAME列将包含与路径无关",并且将省略检查.
As result, FILENAME column for all changesets will contain 'path-independent' and check will be omitted.
这篇关于Liquibase:如何禁用FILENAME列检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!