Skip to content

adzerk-oss/boot-ragtime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

boot-ragtime

Clojars Project

Ragtime migrations with Clojure Boot build tool.

This is a simple task for boot to generate, apply and rollback migrations with weavejester's ragtime.

$ boot ragtime -h
Apply/rollback ragtime migrations

Options:
  -h, --help                Print this help info.
  -d, --database DATABASE   Set database jdbc url to DATABASE.
  -g, --generate MIGRATION  Set name of generated migration to MIGRATION.
  -m, --migrate             Run all the migrations not applied so far.
  -r, --rollback            Increase number of migrations to be immediately rolled back.
  -l, --list-migrations     List all migrations to be applied.
  -c, --driver-class        The JDBC driver class name to initialize.

Examples

To generate brand new migration (up- and down-files located in migrations/ folder):

boot ragtime -g "add-user-table"

To list all the migration not applied so far:

boot ragtime -l -d "jdbc:postgresql://localhost:5432/template1?user=postgres"

To apply those migrations:

boot ragtime -m -d "jdbc:postgresql://localhost:5432/template1?user=postgres"

Finally to rollback latest migration:

boot ragtime -r -d "jdbc:postgresql://localhost:5432/template1?user=postgres"

To rollback 2 latest migrations:

boot ragtime -rr -d ...

To simplify those commands you may set task option in build.boot:

(task-options!
 ragtime {:database "jdbc:postgresql://localhost:5432/template1?user=postgres"})

and now, you may omit -d ... option from command line.

JDBC Driver

If you see an exception like java.sql.SQLException: No suitable driver found, you must explicitly pass the class name of the JDBC driver you're using. For postgres, this is org.postgresql.Driver.

To apply migrations using a specified driver name, you might do:

boot ragtime -m -c org.postgresql.Driver -d "jdbc:postgresql://localhost:5432/template1?user=postgres"

About

Ragtime migrations with Clojure Boot build tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 100.0%