MigrationFile class

Write a Dart migration into db/migration, with the same file name as dox make:migration: 2026_10_21_120000_create_queue_tables.dart.

Use it in a package command that adds a migration, like queue:table. dox migrate then writes db/migration/migrations.dart again (and makes bin/migrate.dart when it is missing), so the new file runs.

Keep the name rules the same as createMigration and nextMigrationTime in dox-cli (lib/src/tools/create_migration.dart). dox-cli can not use dox_core yet, so the rules are in both places.

Constructors

MigrationFile({Directory? folder})
folder is db/migration of the current folder by default.

Properties

folder → Directory
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

create(String name, String source) → String?
write source as a new migration named name (snake case, like create_queue_tables) and return its path. Return null and write nothing when a migration with this name is already in the folder, so a second run does not add the tables twice.
exists(String name) → bool
true when a migration named name is in the folder, at any time
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