Liquibase turns on output mode

problem description

I feel that there is so little information about Liquibase, basically about how to update it directly to the database. I don"t know how to implement its SQL Output mode. I just mentioned it on the official website, but I couldn"t find out where to set it for a long time.

the environmental background of the problems and what methods you have tried

it is now possible to update the database content directly through the gradle plug-in liquibase-gradle-plugin, but the goal is to generate a new sql file with its statements.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

build.gradle

    liquibase {
        activities {
            dev {
                changeLogFile "${rootProject.projectDir}/db/liquibase/changelog-master.yaml"
                url "jdbc:MySQL://localhost:3306/windcoder?characterEncoding=utf8&useSSL=false"
                driver "com.mysql.jdbc.Driver"
                username "windcoder"
                password "root"
                outputFile "${rootProject.projectDir}/db/test.sql"
            }
            runList = "dev" //  
        }

    }

changelog-master.yaml

databaseChangeLog:
- changeSet:
      id: 1
      author: windcoder
      changes:
        - sqlFile:
            encoding: utf8
            path: db/mysql/test1.sql

test1.sql

INSERT INTO `sys_role` ( `name`, `remark`,display_order,created_date,last_modified_date,created_by, last_modified_by) VALUES ("", "",1,now(),now(),2,2);

what result do you expect? What is the error message actually seen?

expects to generate test.sql files, now executing gradle update can only save directly to the database.

Jan.08,2022

accidentally tried gradle updateSQL and succeeded.

Menu