Introduction to DB Migrator

This training provides basic knowledge about Database Migrator (a.k.a. DB Maven Tool) and how it works. Most useful apps rely heavily on data, therefore managing database change is a critical aspect of software development. By the end of this training you should have a rudimentary understanding of how to setup and use a database migrator project and how to run migrations to effect database changes in a way that is consistent and repeatable.


  • Must have previously completed the Introduction to Oracle VM training.
  • Strongly recommend completing the Introduction to Maven training.
  • Basic knowledge of SQL.
  • A workstation running Windows, Linux, or Mac OS.
  • A mild detachment from reality.


DB Migrator Introduction

  • Database evolution challenges
  • Introduce DB Migrator
  • Lab 1 - Download and setup starter project

Configuration, Convention, Features & Commands

  • Project structure
  • Configuration properties
  • Script name convention
  • Features
  • Commands
  • Demo - new, migrate, orphan, status, remigrate, ignoring errors
  • Lab 2 - new, migrate, status, remigrate

Slide Deck


DB Migrator Introduction

Presentation Introduction

Lab 1

  • Bookmark then visit the documentation
  • Install a recent version of maven if you haven't already... (Maven Download Site)
  • Download the db migrator project template
  • Unzip the project into an appropriate place. This will create a folder named "projectx".
  • Start your Oracle VM if it is not already running
  • Open a command prompt and cd into the projectx/db folder
  • run a migration - watch for success: Goal db:migrate successfully executed.
    • mvn -q stack-db:migrate
  • run status - notice the output
    • mvn -q stack-db:status

Lab 1 Solution

Configuration, Convention, Features & Commands

Presentation Configuration and Convention

Lab 2

  • Create a new migration script using the "new" command
    • mvn -q stack-db:new -Ddescription=create_app_role
    • paste the following SQL into the script you just created
drop role &roleForPassThroughAccount;

CREATE ROLE &roleForPassThroughAccount;

GRANT &roleForPassThroughAccount TO &passThroughAccount;
  • add the following properties to your file
  • Run "migrate" to execute the script in the database
    • mvn -q stack-db:migrate
  • Check the database status
    • mvn -q stack-db:status
  • Run "remigrate" to clear out the schema and rebuild it
    • mvn -q stack-db:remigrate
  • Extra Credit: create a reverse script and migrate backwards 1 version

Lab 2 Solution

This page was last modified on 26 October 2012, at 11:00.

Note: Content found in this wiki may not always reflect official Church information.