DatabaseMigrationException class

An error encountered while calling in the course of an upgrade or downgrade.

Generally will be caused by an error thrown in the course of executing an Operation's forward or reverse operation. As this exception implements DatabaseException, if the underlying cause was a DatabaseException, then this exception itself can be used directly to query for common database errors, e.g.

try {
  // open database and migrate (if needed)
} on DatabaseMigrationException catch (err) {
    if (err.isOpenFailedError()) {
      // handle
    } else if (err.isSyntaxError()) {
      // handle
    } else {
      // handle
    }
}

If the underlying cause is other than a DatabaseException, which can often be the cause with custom Operations, the cause can be directly inspected as needed to properly handle the error.

Implemented types

Constructors

DatabaseMigrationException(int fromVersion, int toVersion, int problemVersion, dynamic cause)

Properties

cause ↔ dynamic
The original error thrown
getter/setter pair
fromVersion int
Starting version of the migration being performed when the error occurred
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
problemVersion int
The version whose migration(s) were being executed when the error occurred
getter/setter pair
result Object?
Platform specific error result.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toVersion int
Target end version of the migration being performed when the error occurred
getter/setter pair

Methods

getResultCode() int?
Extended result code on Android/ffi, normal result code on iOS.
isDatabaseClosedError() bool
True if the exception is a database closed error
isDuplicateColumnError([String? column]) bool
True if the exception is a duplicate column error
isNoSuchTableError([String? table]) bool
True if the exception is a no such table exception
isNotNullConstraintError([String? field]) bool
True if the exception is a not null constraint error
isOpenFailedError() bool
True if the exception is an open failed error
isReadOnlyError() bool
True if the exception is a read-only error
isSyntaxError() bool
True if the exception is a syntax error
isUniqueConstraintError([String? field]) bool
True if the exception is a unique constraint error
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited