class Migrator

Properties

protected MigrationRepositoryInterface $repository The migration repository implementation.
protected Filesystem $files The filesystem instance.
protected Builder $schemaBuilder The database schema builder instance.
protected OutputInterface $output The output interface implementation.

Methods

__construct(MigrationRepositoryInterface $repository, ConnectionInterface $connection, Filesystem $files)

Create a new migrator instance.

void
run(string $path, Extension $extension = null)

Run the outstanding migrations at a given path.

void
runMigrationList(string $path, array $migrations, Extension $extension = null)

Run an array of migrations.

void
runUp($path, $file, Extension $extension = null)

Run "up" a migration instance.

int
reset(string $path, Extension $extension = null)

Rolls all of the currently applied migrations back.

void
runDown($path, $file, Extension $extension = null)

Run "down" a migration instance.

runClosureMigration($migration, string $direction = 'up')

Runs a closure migration based on the migrate direction.

array
getMigrationFiles(string $path)

Get all of the migration files in a given path.

array
resolve(string $path, string $file)

Resolve a migration instance from a file.

$this
setOutput(OutputInterface $output)

Set the output implementation that should be used by the console.

void
note(string $message)

Write a note to the conosle's output.

MigrationRepositoryInterface
getRepository()

Get the migration repository instance.

bool
repositoryExists()

Determine if the migration repository exists.

Filesystem
getFilesystem()

Get the file system instance.

Details

__construct(MigrationRepositoryInterface $repository, ConnectionInterface $connection, Filesystem $files)

Create a new migrator instance.

Parameters

MigrationRepositoryInterface $repository
ConnectionInterface $connection
Filesystem $files

void run(string $path, Extension $extension = null)

Run the outstanding migrations at a given path.

Parameters

string $path
Extension $extension

Return Value

void

void runMigrationList(string $path, array $migrations, Extension $extension = null)

Run an array of migrations.

Parameters

string $path
array $migrations
Extension $extension

Return Value

void

protected void runUp($path, $file, Extension $extension = null)

Run "up" a migration instance.

Parameters

$path
$file
Extension $extension

Return Value

void

int reset(string $path, Extension $extension = null)

Rolls all of the currently applied migrations back.

Parameters

string $path
Extension $extension

Return Value

int

protected void runDown($path, $file, Extension $extension = null)

Run "down" a migration instance.

Parameters

$path
$file
Extension $extension

Return Value

void

protected runClosureMigration($migration, string $direction = 'up')

Runs a closure migration based on the migrate direction.

Parameters

$migration
string $direction

Exceptions

Exception

array getMigrationFiles(string $path)

Get all of the migration files in a given path.

Parameters

string $path

Return Value

array

array resolve(string $path, string $file)

Resolve a migration instance from a file.

Parameters

string $path
string $file

Return Value

array

$this setOutput(OutputInterface $output)

Set the output implementation that should be used by the console.

Parameters

OutputInterface $output

Return Value

$this

protected void note(string $message)

Write a note to the conosle's output.

Parameters

string $message

Return Value

void

MigrationRepositoryInterface getRepository()

Get the migration repository instance.

Return Value

MigrationRepositoryInterface

bool repositoryExists()

Determine if the migration repository exists.

Return Value

bool

Filesystem getFilesystem()

Get the file system instance.

Return Value

Filesystem