Want to deploy your JVM, Node.js and Go apps effortlessly to AWS? Try our service Boxfuse

First Steps: Command-line

Downloading and extracting Flyway

Start by downloading the Flyway Command-line Tool for your platform and extract it.

Let's jump into our new directory:

> cd flyway-4.0.3

Configuring Flyway

We can now configure Flyway by editing /conf/flyway.conf like this:


Creating the first migration

Now we can create a first migration in the /sql directory called V1__Create_person_table.sql:

create table PERSON (
    ID int not null,
    NAME varchar(100) not null

Migrating the database

It's now time to execute Flyway to migrate our database:

flyway-4.0.3> flyway migrate

If all went well, you should see the following output:

Creating Metadata table: "PUBLIC"."schema_version"
Current version of schema "PUBLIC": << Empty Schema >>
Migrating schema "PUBLIC" to version 1 - Create person table
Successfully applied 1 migration to schema "PUBLIC" (execution time 00:00.062s).

Adding a second migration

If we now add a second migration to the /sql directory called V2__Add_people.sql:

insert into PERSON (ID, NAME) values (1, 'Axel');
insert into PERSON (ID, NAME) values (2, 'Mr. Foo');
insert into PERSON (ID, NAME) values (3, 'Ms. Bar');

and execute it by issuing:

flyway-4.0.3> flyway migrate

We now get:

Current version of schema "PUBLIC": 1
Migrating schema "PUBLIC" to version 2 - Add people
Successfully applied 1 migration to schema "PUBLIC" (execution time 00:00.090s).


In this brief tutorial we saw how to

  • install the Flyway Command-line tool
  • configure it so it can talk to our database
  • write our first couple of migrations

These migrations were then successfully found and executed.

Read the documentation