class Migrator (View source)
protected Dispatcher | $events | The event dispatcher instance. | |
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 | $paths | The paths to all of the migration files. | |
protected OutputInterface | $output | The output interface implementation. |
void | __construct(MigrationRepositoryInterface $repository, ConnectionResolverInterface $resolver, Filesystem $files, Dispatcher $dispatcher = null) Create a new migrator instance. | |
array | run(array|string $paths = [], array $options = []) Run the pending migrations at a given path. | |
array | pendingMigrations(array $files, array $ran) Get the migration files that have not yet run. | |
void | runPending(array $migrations, array $options = []) Run an array of migrations. | |
void | runUp(string $file, int $batch, bool $pretend) Run "up" a migration instance. | |
array | rollback(array|string $paths = [], array $options = []) Rollback the last migration operation. | |
array | getMigrationsForRollback(array $options) Get the migrations for a rollback operation. | |
array | rollbackMigrations(array $migrations, array|string $paths, array $options) Rollback the given migrations. | |
array | reset(array|string $paths = [], bool $pretend = false) Rolls all of the currently applied migrations back. | |
array | resetMigrations(array $migrations, array $paths, bool $pretend = false) Reset the given migrations. | |
void | runDown(string $file, object $migration, bool $pretend) Run "down" a migration instance. | |
void | runMigration(object $migration, string $method) Run a migration inside a transaction if the database supports it. | |
void | pretendToRun(object $migration, string $method) Pretend to run the migrations. | |
array | getQueries(object $migration, string $method) Get all of the queries that would be run for a migration. | |
object | resolve(string $file) Resolve a migration instance from a file. | |
array | getMigrationFiles(string|array $paths) Get all of the migration files in a given path. | |
void | requireFiles(array $files) Require in all the migration files in a given path. | |
string | getMigrationName(string $path) Get the name of the migration. | |
void | path(string $path) Register a custom migration path. | |
array | paths() Get all of the custom migration paths. | |
string | getConnection() Get the default connection name. | |
mixed | usingConnection(string $name, callable $callback) Execute the given callback using the given connection as the default connection. | |
void | setConnection(string $name) Set the default connection name. | |
Connection | resolveConnection(string $connection) Resolve the database connection instance. | |
Grammar | getSchemaGrammar(Connection $connection) Get the schema grammar out of a migration connection. | |
MigrationRepositoryInterface | getRepository() Get the migration repository instance. | |
bool | repositoryExists() Determine if the migration repository exists. | |
bool | hasRunAnyMigrations() Determine if any migrations have been run. | |
void | deleteRepository() Delete the migration repository data store. | |
Filesystem | getFilesystem() Get the file system instance. | |
$this | setOutput(OutputInterface $output) Set the output implementation that should be used by the console. | |
void | note(string $message) Write a note to the console's output. | |
void | fireMigrationEvent(MigrationEvent $event) Fire the given event for the migration. |
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.
Get the default connection name.
Execute the given callback using the given connection as the default connection.
Set the default connection name.
Resolve the database connection instance.
Get the schema grammar out of a migration connection.
Get the migration repository instance.
Determine if the migration repository exists.
Determine if any migrations have been run.
Delete the migration repository data store.
Get the file system instance.
Set the output implementation that should be used by the console.
Write a note to the console's output.
Fire the given event for the migration.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Database/Migrations/Migrator.html