Migrator
Properties
$repository MigrationRepositoryInterface
The migration repository implementation.
$connection string
The name of the default connection.
$paths array
The paths to all of the migration files.
$requiredPathCache
array|null>
The paths that have already been required.
$output Symfony\...\OutputInterface
The output interface implementation.
Methods
__construct ( MigrationRepositoryInterface $repository , ConnectionResolverInterface $resolver , Filesystem $files , Dispatcher $dispatcher ) : void
Create a new migrator instance.
Parameters
- $repository MigrationRepositoryInterface
- $resolver ConnectionResolverInterface
- $files Filesystem
- $dispatcher Dispatcher |null
run ( $paths , array $options ) : array
Run the pending migrations at a given path.
Parameters
- $paths array|string
- $options array
pendingMigrations ( $files , $ran ) : array
Get the migration files that have not yet run.
Parameters
- $files array
- $ran array
runPending ( array $migrations , array $options ) : void
Run an array of migrations.
Parameters
- $migrations array
- $options array
runUp ( $file , $batch , $pretend ) : void
Run "up" a migration instance.
Parameters
- $file string
- $batch int
- $pretend bool
rollback ( $paths , array $options ) : array
Rollback the last migration operation.
Parameters
- $paths array|string
- $options array
getMigrationsForRollback ( array $options ) : array
Get the migrations for a rollback operation.
Parameters
- $options array
rollbackMigrations ( array $migrations , $paths , array $options ) : array
Rollback the given migrations.
Parameters
- $migrations array
- $paths array|string
- $options array
reset ( $paths , $pretend ) : array
Rolls all of the currently applied migrations back.
Parameters
- $paths array|string
- $pretend bool
resetMigrations ( array $migrations , array $paths , $pretend ) : array
Reset the given migrations.
Parameters
- $migrations array
- $paths array
- $pretend bool
runDown ( $file , $migration , $pretend ) : void
Run "down" a migration instance.
Parameters
- $file string
- $migration object
- $pretend bool
runMigration ( $migration , $method ) : void
Run a migration inside a transaction if the database supports it.
Parameters
- $migration object
- $method string
pretendToRun ( $migration , $method ) : void
Pretend to run the migrations.
Parameters
- $migration object
- $method string
getQueries ( $migration , $method ) : array
Get all of the queries that would be run for a migration.
Parameters
- $migration object
- $method string
runMethod ( $connection , $migration , $method ) : void
Run a migration method on the given connection.
Parameters
- $connection Connection
- $migration object
- $method string
resolve ( $file ) : object
Resolve a migration instance from a file.
Parameters
- $file string
resolvePath ( string $path ) : object
Resolve a migration instance from a migration path.
Parameters
- $path string
getMigrationClass ( string $migrationName ) : string
Generate a migration class name based on the migration file name.
Parameters
- $migrationName string
getMigrationFiles ( $paths ) : array
Get all of the migration files in a given path.
Parameters
- $paths string|array
requireFiles ( array $files ) : void
Require in all the migration files in a given path.
Parameters
- $files array
getMigrationName ( $path ) : string
Get the name of the migration.
Parameters
- $path string
path ( $path ) : void
Register a custom migration path.
Parameters
- $path string
paths ( ) : array
Get all of the custom migration paths.
getConnection ( ) : string
Get the default connection name.
usingConnection ( $name , callable $callback ) : mixed
Execute the given callback using the given connection as the default connection.
Parameters
- $name string
- $callback callable
setConnection ( $name ) : void
Set the default connection name.
Parameters
- $name string
resolveConnection ( $connection ) : Connection
Resolve the database connection instance.
Parameters
- $connection string
getSchemaGrammar ( $connection ) : Grammar
Get the schema grammar out of a migration connection.
Parameters
- $connection Connection
repositoryExists ( ) : bool
Determine if the migration repository exists.
hasRunAnyMigrations ( ) : bool
Determine if any migrations have been run.
deleteRepository ( ) : void
Delete the migration repository data store.
setOutput ( Symfony\...\OutputInterface $output ) : $this
Set the output implementation that should be used by the console.
Parameters
- $output Symfony\...\OutputInterface
write ( $component , $arguments ) : void
Write to the console's output.
Parameters
- $component string
-
$arguments
array
|string
fireMigrationEvent ( $event ) : void
Fire the given event for the migration.
Parameters
- $event MigrationEvent