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
upfunction for all of the available migrations that haven't been processed. - migrateByKey:
Runs the
upfunction for the migration with the givenkeyif it hasn't been processed already (use theforceoption to run for processed migrations). - rollback:
Runs the
downfunction for all of the processed migrations in the last batch. - rollbackByKey:
Runs the
downfunction for the migration with the givenkeyif it has been processed already (use theforceoption 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
keyto identify the migration, anupfunction for migrating, and adownfunction for rolling back. - ProcessedMigration:
An object that represents a migration for which the
upfunction 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
upordownfunction 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
upfunction for a migration that has already been processed. - UnprocessedMigrationError:
An error that is thrown when running the
downfunction for a migration that hasn't been processed yet.