1
0

interfaces.go 622 B

123456789101112
  1. package migres
  2. // Migration is anything that can upgrade or downgrade external state - commonly, but not limited to, database schemas.
  3. //
  4. // Each migration SHOULD be able to upgrade or downgrade freely, allowing any changes to be reverted with ease.
  5. //
  6. // Of course, this is not always possible.
  7. // In the case of irreversible state change, the opposite function should return an error e.g. if an upgrade deletes something irrecoverably, have the corresponding downgrade function throw a descriptive error.
  8. type Migration interface {
  9. Downgrade() error // Perform a downgrade.
  10. Upgrade() error // Perform an upgrade.
  11. }