ragtime.repl

Convenience functions for running in the REPL.

default-reporter

(default-reporter _ op id)
A reporter function that just prints the migration ID to STDOUT.

migrate

(migrate {:keys [datastore migrations strategy reporter], :or {reporter default-reporter, strategy strategy/raise-error}})
Migrate the datastore up to the latest migration. Expects a configuration map
with the following keys:

  :datastore  - a DataStore instance
  :migrations - an ordered collection of Migrations
  :strategy   - the conflict strategy to use
                (defaults to ragtime.strategy/raise-error)
  :reporter   - called when a migration is being applied
                (defaults to default-reporter)

migration-index

An atom holding a map that matches migration IDs to known migrations. This
atom is updated automatically when the migrate or rollback functions are
called.

rollback

(rollback config)(rollback {:keys [datastore migrations reporter], :or {reporter default-reporter}} amount-or-id)
Rollback the datastore one or more migrations. Expects a configuration map
and an optional number of migrations to roll back OR a migration ID to
rollback to. The configuration expects the following keys:

  :datastore  - a DataStore instance
  :migrations - an ordered collection of Migrations
  :reporter   - called when a migration is being applied
                (defaults to default-reporter)