https://github.com/liquibase/liquibase/issues/2681
liquibase.showBanner关闭banner
#!/bin/sh set -e usage() { echo "" echo "" echo "Usage: sh start.sh -dapollo_serving -uroot -proot -h127.0.0.1 -P3306" echo "Usage: sh start.sh -dapollo_serving -uroot -proot -h127.0.0.1 -P3306 -b/home/apollo/apollo-database -v2.0.0" echo "" echo "Note:" echo " -d is database Required" echo " -u is user Required" echo " -p is password Required" echo " -h is host Required" echo " -P is port Required" echo " -b is base directory Optional default work directory" echo " -v is version Optional" echo "" } database="" host="" user="" password="" port="" version="" basedir="" parse(){ if [[ $1 == -d* ]]; then database=${1: 2} elif [[ $1 == -u* ]]; then user=${1: 2} elif [[ $1 == -p* ]]; then password=${1: 2} elif [[ $1 == -h* ]]; then host=${1: 2} elif [[ $1 == -P* ]]; then port=${1: 2} elif [[ $1 == -v* ]]; then version=${1: 2} elif [[ $1 == -b* ]]; then basedir=${1: 2} else echo "not support args: $1" fi } entry() { for opt ; do parse $opt done if [ "x$database" = "x" -o "x$user" = "x" -o "x$password" = "x" -o "x$host" = "x" -o "x$port" = "x" ]; then usage exit -1 fi work_dir=$(cd $(dirname $0); pwd) cd $work_dir if [ "x$basedir" = "x" ]; then basedir=$work_dir echo ">> set base directory $basedir" fi echo "database: $database, user: $user, password: $password, host: $host, port: $port, basedir: $basedir, version: $version" cd $basedir changelog_list=`ls $database/*/db.changelog.xml` cd $work_dir for changelog in $changelog_list do echo "----------------< $changelog begin >----------------" mvn liquibase:update -Dliquibase.showBanner=false -Dliquibase.banner=false -Dliquibase.sql.logLevel=INFO -Dliquibase.logLevel=INFO -Durl="jdbc:mysql://$host:$port/$database?useUnicode=true&characterEncoding=UTF-8&useSSL=false&&serverTimezone=GMT%2b8" -Dusername=$user -Dpassword=$password -DchangeLogFile=$changelog # echo "----------------< $changelog end >----------------" echo "" if [[ "x$version" != "x" && $changelog == *$version* ]] ;then # echo "----------------< version $version finish >----------------" break fi done } if [ $# -lt 5 ]; then usage read -p "Type the Enter key to exit" else entry $* fi
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.x.y</groupId> <artifactId>z-database</artifactId> <version>1.0.0</version> <packaging>pom</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> <version>8.0.31</version> </dependency> <dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-core</artifactId> <version>4.17.2</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId> <version>4.17.2</version> <configuration> <propertyFileWillOverride>true</propertyFileWillOverride> <!--配置参数,以禁用弹出的对话框,该对话框将确认非本地数据库上的迁移--> <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> <!-- <propertyFile>src/main/resources/apollo_board_2.0.0.properties</propertyFile> --> <changeLogFile>${changeLogFile}</changeLogFile> <driver>com.mysql.cj.jdbc.Driver</driver> <url>${url}</url> <username>${username}</username> <password>${password}</password> <!--生成文件的路径--> <outputChangeLogFile>src/main/resources/changelog/changelog.xml</outputChangeLogFile> <dropFirst>false</dropFirst> <!-- <verbose>true</verbose> <logging>debug</logging> --> <rollbackTag>${project.version}</rollbackTag> <tag>${project.version}</tag> <!--输出文件的编码 --> <outputFileEncoding>UTF-8</outputFileEncoding> </configuration> <executions> <execution> <!--配置什么时候执行数据库变更日志中的SQL脚本--> <phase>process-resources</phase> <goals> <!--执行类型--> <goal>update</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
标签:changelog,database,echo,liquibase,version,password From: https://www.cnblogs.com/exmyth/p/17083714.html