我正在尝试构建自定义的液体docker映像(基于官方 liquibase/liquibase:4.3.5
图像),以在Kubernetes中运行数据库迁移。
我正在为数据库使用一些自定义类型,这些类型是使用 @datatypeinfo
注释并扩展现有 liquibaSedatateTypes
类似 liquibase.datatype.core.core.varchartype
((类发现是使用 meta-inf/services/liquibase.datatype.liquibibasedatype
在liquibase 4+中引入的机制的实现。
这些扩展是在其自己的称为“ schema-impl”的Maven模块中实现的,该模块正在生成 schema-impl.jar 。当使用集成在应用程序启动过程中的迁移时,一切都很好,但是现在我们希望由专用Docker Image完成此操作。
有关此主题的液类文档中唯一的信息是驱动程序”部分-and-docker.html“ rel =“ nofollow noreferrer”>此文档。根据此,我将 schema-impl.jar 添加到/liquibase/classpath
在图像构建过程中的目录,还修改了 liquibase.docker.docker.properties
为了在 classPath
属性中明确添加此JAR文件:
classpath: /liquibase/changelog:/liquibase/classpath:/liquibase/classpath/schema-impl.jar
liquibase.headless: true
但是,当我尝试使用Docker Image运行更改时,我总是会遇到错误,因为它找不到它类型定义:
liquibase.exception.DatabaseException: ERROR: type "my-string" does not exist
任何帮助都将不胜感激。提前致谢。
I am trying to build a custom Liquibase docker image (based on the official liquibase/liquibase:4.3.5
image) for running database migrations in Kubernetes.
I am using some custom types for the database which are implemented using @DataTypeInfo
annotation and extending existing LiquibaseDataTypes
like liquibase.datatype.core.VarcharType
(class discovery is implemented using the META-INF/services/liquibase.datatype.LiquibaseDatatype
mechanism introduced in Liquibase 4+).
These extensions are implemented inside their own maven module called "schema-impl", which is generating a schema-impl.jar. Everything was working fine when using migrations integrated inside the app startup process, but now we want this to be done by the dedicated docker image.
The only information in the Liquibase documentation regarding this topic is the "Drivers and extensions" section from this document. According to this, I added the schema-impl.jar into the /liquibase/classpath
directory during the image building process and also modified the liquibase.docker.properties
in order to add this jar file explicitly inside the classpath
property:
classpath: /liquibase/changelog:/liquibase/classpath:/liquibase/classpath/schema-impl.jar
liquibase.headless: true
However, when I try to run my changesets with the docker image, I am always getting an error because it cannot find the custom type definition:
liquibase.exception.DatabaseException: ERROR: type "my-string" does not exist
Any help would be really appreciated. Thanks in advance.
发布评论
评论(1)
好吧,我找到了。基本上,问题是我需要在入口处命令中包括classPath,而不是liquibase.docker.properties文件(对于此用户酶来说似乎没有用),例如:
Ok I found it. Basically the problem was that I needed to include the classpath in the entrypoint command, not in the liquibase.docker.properties file (which seems to be useless for this usecase), like this: