class Migrator

Properties

protected MigrationRepositoryInterface $repository The migration repository implementation.
protected Filesystem $files The filesystem instance.
protected OutputInterface|null $output The output interface implementation.
protected ConnectionInterface $connection

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(string $path, string $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(string $path, string $file, Extension $extension = null)

Run "down" a migration instance.

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

Runs a closure migration based on the migrate direction.

resolveAndRunClosureMigration(string $path, string $file, string $direction = 'up')

Resolves and run a migration and assign the filename to the exception if needed.

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.

installFromSchema(string $path)

Initialize the Flarum database from a schema dump.

$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.

bool
repositoryExists()

Determine if the migration repository exists.

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(string $path, string $file, Extension $extension = null)

Run "up" a migration instance.

Parameters

string $path
string $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(string $path, string $file, Extension $extension = null)

Run "down" a migration instance.

Parameters

string $path
string $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

MigrationKeyMissing

protected resolveAndRunClosureMigration(string $path, string $file, string $direction = 'up')

Resolves and run a migration and assign the filename to the exception if needed.

Parameters

string $path
string $file
string $direction

Exceptions

MigrationKeyMissing

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

installFromSchema(string $path)

Initialize the Flarum database from a schema dump.

Parameters

string $path to the directory containing the dump.

$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

bool repositoryExists()

Determine if the migration repository exists.

Return Value

bool