无法使用 liquibase 架构 xml 文件使用 jOOQ 自动代码生成器生成公共文件
我正在使用 Liquibase 架构 xml 文件通过 jOOQ 自动生成代码。 如果我使用数据库连接进行生成,那么它会在生成的文件夹中创建公共文件,但对于 liquibase 架构则不会。
我希望公共文件出现在生成的文件夹中。现在仅显示这些文件 -
我尝试将 pom.xml 作为 PUBLIC/public/Public 提供,但没有帮助。
为什么我需要公共文件? - 我想使用Table table = PUBLIC.getTable("sometable") 获取所有存在的表。
这是 pom.xml 配置:
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.15.5</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.12</version>
</dependency>
</dependencies>
<configuration>
<generator>
<database>
<name>org.jooq.meta.extensions.liquibase.LiquibaseDatabase</name>
<properties>
<property>
<key>scripts</key>
<value>${basedir}/src/main/resources/database.xml</value>
</property>
<property>
<key>includeLiquibaseTables</key>
<value>true</value>
</property>
</properties>
</database>
<target>
<packageName>jooqGenerated</packageName>
<directory>target/generated-sources/jooq</directory>
</target>
</generator>
</configuration>
</plugin>
这是 liquibase 脚本:
<?xml version="1.0" encoding="UTF-8"?> <databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
>
<changeSet author="Divyanshi (generated)" id="1647260645913-14">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="toBeDeleted2" schemaName="public"/>
</not>
</preConditions>
<createTable tableName="toBeDeleted2" schemaName="public">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true" primaryKeyName="toBeDeleted2_pkey"/>
</column>
<column name="addedAt" type="numeric"/>
<column name="endTime" type="numeric"/>
<column name="startTime" type="numeric"/>
<column name="intervalCount" type="INT"/>
<column name="targetTable" type="VARCHAR(100)"/>
<column name="updatedColumn2" type="numeric"/>
</createTable>
</changeSet>
<changeSet author="Divyanshi" id="finalUpdate">
<renameColumn tableName="toBeDeleted2" remarks="finalUpdate update" oldColumnName="updatedColumn2"
newColumnName="finalUpdate" schemaName="public"/>
</changeSet>
I'm using Liquibase schema xml file to auto-generate code with jOOQ.
If I use db connection for generation, then it creates the Public file in generated folder, but with liquibase schema it doesn't.
I want Public file to appear in the generated folder. Right now only these files appear -
I have tried giving in pom.xml as PUBLIC/public/Public but it isn't helping.
Why do I need Public file? -
I want to use Table<?> table = PUBLIC.getTable("sometable") to get all the tables present.
Here is the pom.xml configuration:
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.15.5</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.12</version>
</dependency>
</dependencies>
<configuration>
<generator>
<database>
<name>org.jooq.meta.extensions.liquibase.LiquibaseDatabase</name>
<properties>
<property>
<key>scripts</key>
<value>${basedir}/src/main/resources/database.xml</value>
</property>
<property>
<key>includeLiquibaseTables</key>
<value>true</value>
</property>
</properties>
</database>
<target>
<packageName>jooqGenerated</packageName>
<directory>target/generated-sources/jooq</directory>
</target>
</generator>
</configuration>
</plugin>
Here is the liquibase script:
<?xml version="1.0" encoding="UTF-8"?> <databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
>
<changeSet author="Divyanshi (generated)" id="1647260645913-14">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="toBeDeleted2" schemaName="public"/>
</not>
</preConditions>
<createTable tableName="toBeDeleted2" schemaName="public">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true" primaryKeyName="toBeDeleted2_pkey"/>
</column>
<column name="addedAt" type="numeric"/>
<column name="endTime" type="numeric"/>
<column name="startTime" type="numeric"/>
<column name="intervalCount" type="INT"/>
<column name="targetTable" type="VARCHAR(100)"/>
<column name="updatedColumn2" type="numeric"/>
</createTable>
</changeSet>
<changeSet author="Divyanshi" id="finalUpdate">
<renameColumn tableName="toBeDeleted2" remarks="finalUpdate update" oldColumnName="updatedColumn2"
newColumnName="finalUpdate" schemaName="public"/>
</changeSet>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论