Skip to content

Integrant methods for running database migrations using Ragtime

Notifications You must be signed in to change notification settings

duct-framework/migrator.ragtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Duct migrator.ragtime Build Status

Integrant methods for running database migrations using Ragtime.

Installation

Add the following dependency to your deps.edn file:

org.duct-framework/migrator.ragtime {:mvn/version "0.5.0"}

Or to your Leiningen project file:

[org.duct-framework/migrator.ragtime "0.5.0"]

Usage

This library provides the :duct.migrator/ragtime Integrant key, which takes five options:

{:duct.migrator/ragtime
 {:database         #ig/ref :duct.database/sql
  :logger           #ig/ref :duct/logger
  :strategy         :rebase
  :migrations-file  "migrations.edn"
  :migrations-table "ragtime_migrations"}}

:database

The :database key should be a SQL database compatible with the Duct database.sql library, such as database.sql.hikaricp:

{:duct.database.sql/hikaricp {:jdbcUrl "jdbc:sqlite:db/foo.sqlite"}}

:logger

The :logger key should be a logger compatible with the Duct logger library, such as [logger.simple][]:

{:duct.logger/simple {:appenders [{:type :stdout}]}}

:strategy

The :strategy is either :apply-new, :raise-error or :rebase. These correspond to the ragtime strategies with the same names.

:migrations-file

A path to an edn file containing a vector of Ragtime SQL migrations.

:migrations-table

Finally, the :migrations-table optional key corresponds to the ragtime sql-database option with the same name. It is the name of the table to store the applied migrations (defaults to "ragtime_migrations" if not specified).

License

Copyright © 2024 James Reeves

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.