Merge pull request #652 from sanketmeghani/master

Database migration using flyway
This commit is contained in:
Zeger Hendrikse 2016-09-05 18:48:11 +02:00 committed by GitHub
commit 230a3054ad
4 changed files with 50 additions and 0 deletions

4
flyway-migration/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.classpath
.project
.settings
target/

View File

@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS `employee` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` varchar(20),
`email` varchar(50),
`date_of_birth` timestamp
)ENGINE=InnoDB DEFAULT CHARSET=UTF8;

View File

@ -0,0 +1,5 @@
flyway.user=root
flyway.password=mysql
flyway.schemas=app-db
flyway.url=jdbc:mysql://localhost:3306/
flyway.locations=filesystem:db/migration

33
flyway-migration/pom.xml Normal file
View File

@ -0,0 +1,33 @@
<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.baeldung</groupId>
<artifactId>flyway-migration</artifactId>
<version>1.0</version>
<name>flyway-migration</name>
<description>A sample project to demonstrate Flyway migrations</description>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>4.0.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>