The facade contains functions for managing and processing migrations.
- clearMigrations: Deletes all logs of processed migrations.
- getMigrations: Returns all of the available migrations (not necessarily processed).
- migrate:
Runs the
up
function for all of the available migrations that haven't been processed. - migrateByKey:
Runs the
up
function for the migration with the givenkey
if it hasn't been processed already (use theforce
option to run for processed migrations). - rollback:
Runs the
down
function for all of the processed migrations in the last batch. - rollbackByKey:
Runs the
down
function for the migration with the givenkey
if it has been processed already (use theforce
option to run for unprocessed migrations).
This package also contains some types that you might find useful.
- Migration:
An object that represents an available migration, with a
key
to identify the migration, anup
function for migrating, and adown
function for rolling back. - ProcessedMigration:
An object that represents a migration for which the
up
function has been ran already.
This package also contains some error classes that you might want to use.
- DuplicateKeyError: An error that is thrown when the same key has been used by two or more migrations.
- FailingMigrationError:
An error that is thrown when a
up
ordown
function throws an error during processing. - LockedMigrationError: An error that is thrown when another process is processing migrations.
- MissingMigrationError: An error that is thrown when migrating or rolling back with a key that doesn't exist for any migrations.
- ProcessedMigrationError:
An error that is thrown when running the
up
function for a migration that has already been processed. - UnprocessedMigrationError:
An error that is thrown when running the
down
function for a migration that hasn't been processed yet.