简体   繁体   English

Liquibase 随附 Spring Boot 使用 changelog.xml 很好地处理数据库。 它如何同时生成其 sql?

[英]Liquibase coming with Spring Boot handles the database well with changelog.xml. How can it generate its sql at the same time?

I'm using the default Liquibase configuration coming with Spring Boot .我使用的是Spring Boot附带的默认Liquibase配置。

I have:我有:

  • a changelog.xml file in src/main/resources/db/changelog that works fine, src/main/resources/db/changelog中的changelog.xml文件工作正常,
  • along with url , changeLogFile , driver , username , password properties in application.properties ,连同urlchangeLogFiledriverusernameapplication.properties中的password属性,
  • and a Maven pom.xml having this for <dependency> and <dependencyManagement> :和一个Maven pom.xml有这个<dependency><dependencyManagement>
    <dependencies>
        ...

        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.liquibase</groupId>
                    <artifactId>liquibase-maven-plugin</artifactId>

                    <configuration>
                        <promptOnNonLocalDatabase>true</promptOnNonLocalDatabase>
                        <propertyFile>${project.basedir}/../ApplicationMetierEtGestion/src/main/resources/application.properties</propertyFile>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

Aside from the update of the database structure led by changelog.xml that is working fine at development time, I would like Liquibase to generate also the related SQL files (by the mean of its updateSQL command).除了在开发时运行良好的由changelog.xml领导的数据库结构更新之外,我希望Liquibase生成相关的SQL文件(通过其 updateSQL 命令)。
This, because the next environments might not have Liquibase to handle the database updates.这是因为下一个环境可能没有Liquibase来处理数据库更新。

How can I do that from here?我怎么能从这里做到这一点?

Liquibase has a goal that generates this SQL for you which is called updateSQL. Liquibase 的目标是为您生成这个 SQL,称为 updateSQL。
Have a look as it might be interesting in your case.看看你的情况可能会很有趣。
https://docs.liquibase.com/tools-integrations/maven/commands/maven-updatesql.html https://docs.liquibase.com/tools-integrations/maven/commands/maven-updatesql.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您可以从 SQL 代码生成 Liquibase 更改日志 XML 文件吗? - Can you generate a Liquibase changelog XML file from SQL code? 使用liquibase为单个SQL文件生成changeLog - Generate changeLog for single sql files with liquibase 如何将属性值动态传递给 liquibase 更改日志中的 sql 标记 - How to pass property value dynamically to sql tag in liquibase changelog 有没有办法将 SQL 查询转换为 liquibase 更改日志格式? - Is there a way to convert SQL queries to liquibase changelog format? liqubase:在没有数据库连接的情况下从changelog xml生成SQL脚本 - liqubase: generate sql script from changelog xml without db connection 如何在 sql 服务器中配置多个目录/数据库,这些目录/数据库位于 spring 启动 java 8 应用程序中的同一数据库服务器上? - How to configure multiple catalogs/databases in sql server which are on same database server in spring boot java 8 app? 如何在 SQL 中添加一列并在单个查询中同时基于其他列设置其值? - How can i add a column in SQL and set its values based on other columns at the same time in a single query? 如何使用sql和php在每天的固定时间自动在数据库中插入相同记录? - using sql and php how can i insert same record in my database automatically in a fixed time of everyday? SQL FOR XML 生成多个同名节点 - SQL FOR XML to generate multiple same name nodes 如何从 sql 服务器中的 XML 生成特定表? - How Can I generate specific table from XML in sql server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM