Migrator
class Migrator (View source)
Properties
| 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.  | 
                |
| static protected Closure|null | $connectionResolverCallback | The custom connection resolver callback.  | 
                |
| protected string | $connection | The name of the default connection.  | 
                |
| protected string[] | $paths | The paths to all of the migration files.  | 
                |
| static protected Migration|null> | $requiredPathCache | The paths that have already been required.  | 
                |
| protected OutputInterface | $output | The output interface implementation.  | 
                |
| static protected list<string> | $withoutMigrations | The pending migrations to skip.  | 
                
Methods
Create a new migrator instance.
Run the pending migrations at a given path.
Get the migration files that have not yet run.
Get list of pending migrations to skip.
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.
Run a migration method on the given connection.
Resolve a migration instance from a file.
Resolve a migration instance from a migration path.
Generate a migration class name based on the migration file name.
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 pending migrations to skip.
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 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 to the console's output.
Details
        
                            
    __construct(MigrationRepositoryInterface $repository, ConnectionResolverInterface $resolver, Filesystem $files, Dispatcher|null $dispatcher = null)
        
    
    Create a new migrator instance.
        
                            string[]
    run(string[]|string $paths = [], array $options = [])
        
    
    Run the pending migrations at a given path.
        
                    protected        string[]
    pendingMigrations(string[] $files, string[] $ran)
        
    
    Get the migration files that have not yet run.
        
                    protected        list<string>
    migrationsToSkip()
        
    
    Get list of pending migrations to skip.
        
                            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.
        
                            string[]
    rollback(string[]|string $paths = [], array $options = [])
        
    
    Rollback the last migration operation.
        
                    protected        array
    getMigrationsForRollback(array $options)
        
    
    Get the migrations for a rollback operation.
        
                    protected        string[]
    rollbackMigrations(array $migrations, string[]|string $paths, array $options)
        
    
    Rollback the given migrations.
        
                            array
    reset(string[]|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.
        
                    protected        void
    runMethod(Connection $connection, object $migration, string $method)
        
    
    Run a migration method on the given connection.
        
                            object
    resolve(string $file)
        
    
    Resolve a migration instance from a file.
        
                    protected        object
    resolvePath(string $path)
        
    
    Resolve a migration instance from a migration path.
        
                    protected        string
    getMigrationClass(string $migrationName)
        
    
    Generate a migration class name based on the migration file name.
        
                            array<string,string>
    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.
        
                            string[]
    paths()
        
    
    Get all of the custom migration paths.
        
                static            void
    withoutMigrations(array $migrations)
        
    
    Set the pending migrations to skip.
        
                            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.
        
                static            void
    resolveConnectionsUsing(Closure $callback)
        
    
    Set a connection resolver callback.
        
                    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.
        
                            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.
        
                    protected        void
    write(string $component, array<int,string>|string ...$arguments)
        
    
    Write to the console's output.
        
                            void
    fireMigrationEvent(MigrationEvent $event)
        
    
    Fire the given event for the migration.