Menu

Flyway_Integration

Scott Forest Hull II Dasha
There is a newer version of this page. You can find it here.

Introduction

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.

Getting Started

Download and incorporate flyway jar into your product configuration. That's it.

Link to the website here: www.flywaydb.org

How to incorporate flyway into an existing database pt1

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"

How to incorporate flyway into an existing database pt2

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();

Step by Step guide to setup Flyway command line tool

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

References

Flyway: www.flywaydb.org


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.