This is a work in progress. Once I figure out how to get the datasource out of the running jpa implementation, I will be able to configure these tools accordingly and get flyway working with the database.
Download and incorporate flyway jar into your product configuration. That's it.
Link to the website here: www.flywaydb.org
First step is to generate the (Data Definition Language) DDL files from the database. This is literally a dump of all the tables's schemas in the database and it's current configuration. Flyway will use this as a "starting point" for the database.
With a simple google, I found a way to generate this file with dblook:
http://db.apache.org/derby/docs/10.9/tools/ctoolsusingdblook.html
From flywaydb.org:
"This script will form your base migration. Save it on the classpath in the directory you configured with baseDir. Give it a relevant version number and description such as V1__Base_version.sql. "
Run a clean on the database (flyway:clean) and then run the following operation once the sql file is generated and ready to go.
mvn flyway:init -Dflyway.initialVersion=1 -Dflyway.initialDescription="Base version"
Once the external files are setup, the actual source code needs to be added to the application to handle migrations.
Here is some sample code below:
Flyway flyway = new Flyway();
flyway.setDataSource(/*Still need to be able to get this information somehow*/);
flyway.migrate();
In order to migrate an existing database into a new database, there are several files that need to be downloaded and configured before this will work.
You need the latest derby files. These can be downloaded here: http://db.apache.org/derby/derby_downloads.html
You will also
Flyway: www.flywaydb.org