Migrate Class

package Fuel
category Migrations
link http://docs.fuelphp.com/classes/migrate.html

 Methods

loads in the migrations config file, checks to see if the migrations table is set in the database (if not, create it), and reads in all of the versions from the DB.

_init() : void

migrate to the version defined in the config file

current(string $name, string $type) : array

Parameters

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

Returns

array

migrate down to the previous version

down(mixed $version, string $name, string $type) : array

Parameters

$version

mixed

version to migrate down to

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

Returns

array

migrate to a latest version

latest(string $name, string $type, bool $all) : array

Parameters

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

$all

bool

if true, also run out-of-sequence migrations

Returns

array

migrate up to the next version

up(mixed $version, string $name, string $type) : array

Parameters

$version

mixed

version to migrate up to

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

Returns

array

migrate to a specific version, range of versions, or all

version(mixed $version, string $name, string $type, bool $all) : array

Parameters

$version

mixed

version to migrate to (up or down!)

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

$all

bool

if true, also run out-of-sequence migrations

Exceptions

\UnexpectedValueException

Returns

array

finds migrations for the given app

_find_app(string $name) : array

Parameters

$name

string

name of the app (not used at the moment)

Returns

array

finds migrations for the given module (or all if name is not given)

_find_module(string $name) : array

Parameters

$name

string

name of the module

Returns

array

finds migrations for the given package (or all if name is not given)

_find_package(string $name) : array

Parameters

$name

string

name of the package

Returns

array

run the actual migration, and it's before and after methods if present

_run($class, $method) 

Parameters

$class

$method

migrate down to the previous version

find_migrations(string $name, string $type, mixed $start, mixed $end, string $direction) : array

Parameters

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

$start

mixed

version to start migrations from, or null to start at the beginning

$end

mixed

version to end migrations by, or null to migrate to the end

$direction

string

Exceptions

\FuelException

Returns

array

run the action migrations found

run(array $migrations, string $name, string $type, string $method) : array

Parameters

$migrations

array

list of files to migrate

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

$method

string

method to call on the migration

Returns

array

installs or upgrades the migration table to the current schema

table_version_check() : void

deprecated Remove upgrade check in 1.4

add an installed migration to the database

write_install(string $name, string $type, string $file) : void

Parameters

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

$file

string

name of the migration file just run

remove a reverted migration from the database

write_revert(string $name, string $type, string $file) : void

Parameters

$name

string

name of the package, module or app

$type

string

type of migration (package, module or app)

$file

string

name of the migration file just run

 Properties

 

<p>database connection group</p>

$connection : string

 

<p>current migrations registered in the database</p>

$migrations : array

 

<p>migration classes namespace prefix</p>

$prefix : string

 

<p>name of the migration table</p>

$table : string

 

<p>migration table schema</p>

$table_definition : array