Migrator
class Migrator (View source)
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 | $paths | The paths to all of the migration files. | |
protected OutputStyle | $output | The output interface implementation. |
Methods
void | __construct(MigrationRepositoryInterface $repository, ConnectionResolverInterface $resolver, Filesystem $files) 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. | |
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. | |
Filesystem | getFilesystem() Get the file system instance. | |
$this | setOutput(OutputStyle $output) Set the output implementation that should be used by the console. | |
void | note(string $message) Write a note to the conosle's output. |
Details
void __construct(MigrationRepositoryInterface $repository, ConnectionResolverInterface $resolver, Filesystem $files)
Create a new migrator instance.
array run(array|string $paths = [], array $options = [])
Run the pending migrations at a given path.
protected 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.
protected 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.
protected array getMigrationsForRollback(array $options)
Get the migrations for a rollback operation.
protected 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.
protected array resetMigrations(array $migrations, array $paths, bool $pretend = false)
Reset the given migrations.
protected void runDown(string $file, object $migration, bool $pretend)
Run "down" a migration instance.
protected void runMigration(object $migration, string $method)
Run a migration inside a transaction if the database supports it.
protected void pretendToRun(object $migration, string $method)
Pretend to run the migrations.
protected 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.
void setConnection(string $name)
Set the default connection name.
Connection resolveConnection(string $connection)
Resolve the database connection instance.
protected 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.
Filesystem getFilesystem()
Get the file system instance.
$this setOutput(OutputStyle $output)
Set the output implementation that should be used by the console.
protected void note(string $message)
Write a note to the conosle's output.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Database/Migrations/Migrator.html