Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public class MigrationException
- Object
- Throwable
- Exception
- IOException
- MigrationException
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.Fields
public static final int VALIDATE_FAILED = 1 | The applied history does not match the migrations this build carries. |
public static final int FAILED_MIGRATION_PRESENT = 2 | A previous run left a migration marked failed; call Migrator.repair() after cleaning up. |
public static final int FUTURE_SCHEMA = 3 | The database was migrated by a newer build than this one. |
public static final int CLEAN_DISABLED = 4 | Migrator.clean() was called while clean is disabled. |
public static final int LOCK_TIMEOUT = 5 | Another process held the migration lock for longer than this run was willing to wait. |
public static final int SCRIPT_FAILED = 6 | A migration script or Java migration threw. |
public static final int NON_EMPTY_SCHEMA = 7 | The database has tables and no history, and no baseline was requested. |
public static final int INVALID_SET = 8 | The migration set itself is wrong: a duplicate version, a script missing for this engine. |
Constructors
public MigrationException(int code, String message) | Creates a failure of the given kind. |
public MigrationException(int code, String message, Throwable cause) | Creates a failure of the given kind, keeping the database error that caused it. |
Methods
public int getCode() | The kind of failure. |
Inherited methods
Field details
VALIDATE_FAILED
public static final int VALIDATE_FAILED = 1The applied history does not match the migrations this build carries.
FAILED_MIGRATION_PRESENT
public static final int FAILED_MIGRATION_PRESENT = 2A previous run left a migration marked failed; call
Migrator.repair() after cleaning up.FUTURE_SCHEMA
public static final int FUTURE_SCHEMA = 3The database was migrated by a newer build than this one.
CLEAN_DISABLED
public static final int CLEAN_DISABLED = 4Migrator.clean() was called while clean is disabled.LOCK_TIMEOUT
public static final int LOCK_TIMEOUT = 5Another process held the migration lock for longer than this run was willing to wait.
SCRIPT_FAILED
public static final int SCRIPT_FAILED = 6A migration script or Java migration threw.
NON_EMPTY_SCHEMA
public static final int NON_EMPTY_SCHEMA = 7The database has tables and no history, and no baseline was requested.
INVALID_SET
public static final int INVALID_SET = 8The migration set itself is wrong: a duplicate version, a script missing for this engine.
Constructor details
MigrationException
public MigrationException(int code, String message)Creates a failure of the given kind.
Parameters
codeint- one of the constants of this class
messageString- 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
codeint- one of the constants of this class
messageString- what was refused and what to do about it
causeThrowable- the underlying failure
Method details
getCode
public int getCode()The kind of failure.
Returns
one of the constants of this class