Migrator
class Migrator
Properties
protected MigrationRepositoryInterface | $repository | The migration repository implementation. |
|
protected Filesystem | $files | The filesystem instance. |
|
protected ConnectionResolverInterface | $resolver | The connection resolver instance. |
|
protected string | $connection | The name of the default connection. |
|
protected array | $notes | The notes for the current operation. |
|
protected array | $paths | The paths to all of the migration files. |
Methods
Create a new migrator instance.
Run the pending migrations at a given path.
Get the migration files that have not yet run.
Run an array of migrations.
Run "up" a migration instance.
Rollback the last migration operation.
Get the migrations for a rollback operation.
Rollback the given migrations.
Rolls all of the currently applied migrations back.
Reset the given migrations.
Run "down" a migration instance.
Run a migration inside a transaction if the database supports it.
Pretend to run the migrations.
Get all of the queries that would be run for a migration.
Resolve a migration instance from a file.
Get all of the migration files in a given path.
Require in all the migration files in a given path.
Get the name of the migration.
Register a custom migration path.
Get all of the custom migration paths.
Set the default connection name.
Resolve the database connection instance.
Get the migration repository instance.
Determine if the migration repository exists.
Get the file system instance.
Raise a note event for the migrator.
Get the notes for the last operation.
Details
at line 63
void
__construct(MigrationRepositoryInterface $repository, ConnectionResolverInterface $resolver, Filesystem $files)
Create a new migrator instance.
at line 79
array
run(array|string $paths = [], array $options = [])
Run the pending migrations at a given path.
at line 107
protected array
pendingMigrations(array $files, array $ran)
Get the migration files that have not yet run.
at line 122
void
runPending(array $migrations, array $options = [])
Run an array of migrations.
at line 162
protected void
runUp(string $file, int $batch, bool $pretend)
Run "up" a migration instance.
at line 194
array
rollback(array|string $paths = [], array $options = [])
Rollback the last migration operation.
at line 218
protected array
getMigrationsForRollback(array $options)
Get the migrations for a rollback operation.
at line 235
protected array
rollbackMigrations(array $migrations, array|string $paths, array $options)
Rollback the given migrations.
at line 271
array
reset(array|string $paths = [], bool $pretend = false)
Rolls all of the currently applied migrations back.
at line 297
protected array
resetMigrations(array $migrations, array $paths, bool $pretend = false)
Reset the given migrations.
at line 319
protected void
runDown(string $file, object $migration, bool $pretend)
Run "down" a migration instance.
at line 351
protected void
runMigration(object $migration, string $method)
Run a migration inside a transaction if the database supports it.
at line 375
protected void
pretendToRun(object $migration, string $method)
Pretend to run the migrations.
at line 391
protected array
getQueries(object $migration, string $method)
Get all of the queries that would be run for a migration.
at line 413
object
resolve(string $file)
Resolve a migration instance from a file.
at line 426
array
getMigrationFiles(string|array $paths)
Get all of the migration files in a given path.
at line 443
void
requireFiles(array $files)
Require in all the migration files in a given path.
at line 456
string
getMigrationName(string $path)
Get the name of the migration.
at line 467
void
path(string $path)
Register a custom migration path.
at line 477
array
paths()
Get all of the custom migration paths.
at line 488
void
setConnection(string $name)
Set the default connection name.
at line 505
Connection
resolveConnection(string $connection)
Resolve the database connection instance.
at line 516
protected Grammar
getSchemaGrammar(Connection $connection)
Get the schema grammar out of a migration connection.
at line 532
MigrationRepositoryInterface
getRepository()
Get the migration repository instance.
at line 542
bool
repositoryExists()
Determine if the migration repository exists.
at line 552
Filesystem
getFilesystem()
Get the file system instance.
at line 563
protected void
note(string $message)
Raise a note event for the migrator.
at line 573
array
getNotes()
Get the notes for the last operation.