ragtime.core
Functions for applying and rolling back migrations.
applied-migrations
(applied-migrations store index)
List all migrations in the index that are applied to the database.
into-index
(into-index migrations)
(into-index index migrations)
Add migrations to a map, using their :id as the key.
migrate
(migrate store migration)
Apply a single migration to a data store.
migrate-all
(migrate-all store index migrations)
(migrate-all store index migrations options)
Migrate a data store with the supplied index and migration sequence. The
index matches IDs in the data store with their associated migrations. The
migrations should be a sequential collection in the order in which they
should be applied to the database.
An additional map of options may be supplied that contains the following
keys:
:strategy - defines what to do if there are conflicts between the migrations
applied to the data store, and the migrations that need to be
applied. The default strategy is ragtime.strategy/raise-error.
:reporter - a function that takes three arguments: the store, the operation
(:up or :down) and the migration ID. The reporter is a
side-effectful callback that can be used to print or report on
the migrations as they are applied. The default reporter is
ragtime.reporter/silent.
rollback
(rollback store migration)
Rollback a migration already applied to the database.
rollback-last
(rollback-last store index)
(rollback-last store index n)
(rollback-last store index n options)
Rollback the last n migrations from the database, using the supplied
migration index. If n is not specified, only the very last migration is
rolled back.
Takes an option map that may include the :reporter key. See migrate-all.
rollback-to
(rollback-to store index migration-id)
(rollback-to store index migration-id options)
Rollback to a specific migration ID, using the supplied migration index.
Takes an option map that may include the :reporter key. See migrate-all.