MigrationManager class
Handles applying database migrations.
Constructors
- MigrationManager(MigrationArtifactStoreReader _artifactStore, {String? runMode})
- Creates a new migration manager.
- MigrationManager.fromDirectory(Directory projectDirectory, {String? runMode})
-
Reads migrations from
<projectDirectory>/migrations/. -
MigrationManager.fromMigrations({required List<
MigrationVersionSql> migrations, required String moduleName, String? runMode}) - Reads migrations from an in-memory list. Repair migrations are not supported.
Properties
-
availableVersions
→ List<
String> -
List of available migration versions as loaded from the migrations
directory. Available after starting a migration or repair migration.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runMode → String?
-
The run mode of the server.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
applyRepairMigration(
DatabaseSession session) → Future< String?> - Applies the repair migration to the database.
-
listAvailableVersions(
) → Future< List< String> > - Lists all available migration versions.
-
loadInstalledRepairMigration(
DatabaseSession session, {Transaction? transaction}) → Future< DatabaseMigrationVersionModel?> - Loads the installed repair migration from the database.
-
loadInstalledVersions(
DatabaseSession session, {Transaction? transaction}) → Future< List< DatabaseMigrationVersionModel> > - Loads the installed versions of the migrations from the database.
-
migrateToLatest(
DatabaseSession session) → Future< List< String> ?> - Migrates all modules to the latest version.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
verifyDatabaseIntegrity(
DatabaseSession session) → Future< bool> -
Returns true if the database structure is up to date. If not, it
logs a warning via the global
log.