db-deployer

simple database script management library

License

License

GroupId

GroupId

io.github.yangshuo
ArtifactId

ArtifactId

db-deployer
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

pom
Description

Description

db-deployer
simple database script management library
Project URL

Project URL

https://github.com/yangshuo/db-deployer
Source Code Management

Source Code Management

https://github.com/yangshuo/db-deployer

Download db-deployer

Filename Size
db-deployer-1.0.2.pom 7 KB
Browse

How to add to project

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

  • db-deployer-api
  • db-deployer-impl
  • db-deployer-maven-plugin
  • db-deployer-maven-plugin-demo

[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