io.github.yangshuo:db-deployer-api

simple database script management library

License

License

GroupId

GroupId

io.github.yangshuo
ArtifactId

ArtifactId

db-deployer-api
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

simple database script management library

Download db-deployer-api

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.yangshuo/db-deployer-api/ -->
<dependency>
    <groupId>io.github.yangshuo</groupId>
    <artifactId>db-deployer-api</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.yangshuo/db-deployer-api/
implementation 'io.github.yangshuo:db-deployer-api:1.0.2'
// https://jarcasting.com/artifacts/io.github.yangshuo/db-deployer-api/
implementation ("io.github.yangshuo:db-deployer-api:1.0.2")
'io.github.yangshuo:db-deployer-api:jar:1.0.2'
<dependency org="io.github.yangshuo" name="db-deployer-api" rev="1.0.2">
  <artifact name="db-deployer-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.yangshuo', module='db-deployer-api', version='1.0.2')
)
libraryDependencies += "io.github.yangshuo" % "db-deployer-api" % "1.0.2"
[io.github.yangshuo/db-deployer-api "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

[TOC]

Recommended Project Structure

project
|  pom.xml
|__sqls
   |  DDL_20180801231423.sql
   |  DML_20180801531423.sql
   |  ...

Usage

Use the plugin

<build>
		<plugins>
			<plugin>
				<groupId>io.github.yangshuo</groupId>
				<artifactId>db-deployer-maven-plugin</artifactId>
				<version>1.0.2-SNAPSHOT</version>
			</plugin>
		</plugins>
	</build>

Configuration

Config the plugin in xml

	<build>
		<plugins>
			<plugin>
				<groupId>io.github.yangshuo</groupId>
				<artifactId>db-deployer-maven-plugin</artifactId>
				<version>1.0.2-SNAPSHOT</version>
				<configuration>
					<driverClass>com.mysql.jdbc.Driver</driverClass>
					<url>jdbc:mysql://localhost:3306/demo</url>
					<username>demo</username>
					<password>demo</password>
					<sqlScriptDir>sqls</sqlScriptDir>
					<sqlStatementDelimiter>/</sqlStatementDelimiter>
				</configuration>
			</plugin>
		</plugins>
	</build>
  • jdbcDriver : The name of the jdbc driver used, for example com.mysql.jdbc.Driver
  • url : The jdbc url, for example jdbc:mysql://localhost:3306/demo
  • username : The user name used to connect to db
  • password : The password used to connect to db
  • sqlScriptDir : The diectory of the sql scripts
  • sqlStatementDelimiter: The statement delimiter used to split sql statement in sql files, for example semicolon(;)

Config the plugin using system properties

	<build>
		<plugins>
			<plugin>
				<groupId>org.yshio.github.yangshuo</groupId>
				<artifactId>db-deployer-maven-plugin</artifactId>
				<version>1.0.2-SNAPSHOT</version>
			</plugin>
		</plugins>
	</build>
	mvn dbdeployer:reset
		-Djdbc.driverClass=com.mysql.jdbc.Driver 
		-Djdbc.url=jdbc:mysql://localhost:3306/demo 
		-Djdbc.username=demo 
		-Djdbc.password=demo 
		-Dsql.scriptDir=sqls 
		-Dsql.statementDelimiter=;

Goals

  • dbdeployer:DDL
    Create a new DDL script file
  • dbdeployer:DML
    Create a new DML script file
  • dbdeployer:reset
    Execute all the sql script files
  • dbdeployer:update
    Execute the un executed sql script file

Versions

Version
1.0.2