Skip to content

Latest commit

 

History

History
39 lines (32 loc) · 2.39 KB

facade.md

File metadata and controls

39 lines (32 loc) · 2.39 KB

Facade

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 given key if it hasn't been processed already (use the force 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 given key if it has been processed already (use the force 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, an up function for migrating, and a down 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 or down 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.