Class MigrationException


public class MigrationException extends IOException
A migration run that was refused or failed. getCode() says which, so a caller can tell a database that is newer than the application from a script that did not run.
  • Field Details

    • VALIDATE_FAILED

      public static final int VALIDATE_FAILED
      The applied history does not match the migrations this build carries.
      See Also:
    • FAILED_MIGRATION_PRESENT

      public static final int FAILED_MIGRATION_PRESENT
      A previous run left a migration marked failed; call Migrator.repair() after cleaning up.
      See Also:
    • FUTURE_SCHEMA

      public static final int FUTURE_SCHEMA
      The database was migrated by a newer build than this one.
      See Also:
    • CLEAN_DISABLED

      public static final int CLEAN_DISABLED
      Migrator.clean() was called while clean is disabled.
      See Also:
    • LOCK_TIMEOUT

      public static final int LOCK_TIMEOUT
      Another process held the migration lock for longer than this run was willing to wait.
      See Also:
    • SCRIPT_FAILED

      public static final int SCRIPT_FAILED
      A migration script or Java migration threw.
      See Also:
    • NON_EMPTY_SCHEMA

      public static final int NON_EMPTY_SCHEMA
      The database has tables and no history, and no baseline was requested.
      See Also:
    • INVALID_SET

      public static final int INVALID_SET
      The migration set itself is wrong: a duplicate version, a script missing for this engine.
      See Also:
  • Constructor Details

    • MigrationException

      public MigrationException(int code, String message)
      Creates a failure of the given kind.
      Parameters:
      code - one of the constants of this class
      message - what was refused and what to do about it
    • MigrationException

      public MigrationException(int code, String message, Throwable cause)
      Creates a failure of the given kind, keeping the database error that caused it.
      Parameters:
      code - one of the constants of this class
      message - what was refused and what to do about it
      cause - the underlying failure
  • Method Details

    • getCode

      public int getCode()
      The kind of failure.
      Returns:
      one of the constants of this class