class Migrator

Properties

protected MigrationRepositoryInterface $repository <p>The migration repository implementation.</p>
protected Filesystem $files <p>The filesystem instance.</p>
protected OutputInterface $output <p>The output interface implementation.</p>
protected ConnectionInterface|MySqlConnection $connection

Methods

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

<p>Create a new migrator instance.</p>

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

<p>Run the outstanding migrations at a given path.</p>

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

<p>Run an array of migrations.</p>

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

<p>Run &quot;up&quot; a migration instance.</p>

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

<p>Rolls all of the currently applied migrations back.</p>

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

<p>Run &quot;down&quot; a migration instance.</p>

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

<p>Runs a closure migration based on the migrate direction.</p>

array
getMigrationFiles(string $path)

<p>Get all of the migration files in a given path.</p>

array
resolve(string $path, string $file)

<p>Resolve a migration instance from a file.</p>

installFromSchema(string $path)

<p>Initialize the Flarum database from a schema dump.</p>

$this
setOutput(OutputInterface $output)

<p>Set the output implementation that should be used by the console.</p>

void
note(string $message)

<p>Write a note to the conosle's output.</p>

bool
repositoryExists()

<p>Determine if the migration repository exists.</p>

Details

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

<p>Create a new migrator instance.</p>

Parameters

MigrationRepositoryInterface $repository
ConnectionInterface $connection
Filesystem $files

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

<p>Run the outstanding migrations at a given path.</p>

Parameters

string $path
Extension $extension

Return Value

void

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

<p>Run an array of migrations.</p>

Parameters

string $path
array $migrations
Extension $extension

Return Value

void

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

<p>Run &quot;up&quot; a migration instance.</p>

Parameters

string $path
string $file
Extension $extension

Return Value

void

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

<p>Rolls all of the currently applied migrations back.</p>

Parameters

string $path
Extension $extension

Return Value

int

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

<p>Run &quot;down&quot; a migration instance.</p>

Parameters

string $path
string $file
Extension $extension

Return Value

void

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

<p>Runs a closure migration based on the migrate direction.</p>

Parameters

$migration
string $direction

Exceptions

Exception

array getMigrationFiles(string $path)

<p>Get all of the migration files in a given path.</p>

Parameters

string $path

Return Value

array

array resolve(string $path, string $file)

<p>Resolve a migration instance from a file.</p>

Parameters

string $path
string $file

Return Value

array

installFromSchema(string $path)

<p>Initialize the Flarum database from a schema dump.</p>

Parameters

string $path <p>to the directory containing the dump.</p>

$this setOutput(OutputInterface $output)

<p>Set the output implementation that should be used by the console.</p>

Parameters

OutputInterface $output

Return Value

$this

protected void note(string $message)

<p>Write a note to the conosle's output.</p>

Parameters

string $message

Return Value

void

bool repositoryExists()

<p>Determine if the migration repository exists.</p>

Return Value

bool