Skip to content

CI_Migration

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

CI_Migration

Migration Class

All migrations should implement this, forces up() and down() and gives access to the CI super-global.

  • Class name: CI_Migration
  • Namespace:

Properties

$_migration_enabled

protected boolean $_migration_enabled = FALSE

Whether the library is enabled

  • Visibility: protected

$_migration_type

protected boolean $_migration_type = 'sequential'

Migration numbering type

  • Visibility: protected

$_migration_path

protected string $_migration_path = NULL

Path to migration classes

  • Visibility: protected

$_migration_version

protected mixed $_migration_version

Current migration version

  • Visibility: protected

$_migration_table

protected string $_migration_table = 'migrations'

Database table with migration info

  • Visibility: protected

$_migration_auto_latest

protected boolean $_migration_auto_latest = FALSE

Whether to automatically run migrations

  • Visibility: protected

$_migration_regex

protected boolean $_migration_regex = NULL

Migration basename regex

  • Visibility: protected

$_error_string

protected string $_error_string = ''

Error message

  • Visibility: protected

Methods

__construct

void CI_Migration::__construct(array $config)

Initialize Migration Class

  • Visibility: public

Arguments

  • $config array

version

mixed CI_Migration::version(string $target_version)

Migrate to a schema version

Calls each migration step required to get to the schema version of choice

  • Visibility: public

Arguments

  • $target_version string - <p>Target schema version</p>

latest

mixed CI_Migration::latest()

Sets the schema to the latest migration

  • Visibility: public

current

mixed CI_Migration::current()

Sets the schema to the migration version set in config

  • Visibility: public

error_string

string CI_Migration::error_string()

Error string

  • Visibility: public

find_migrations

array CI_Migration::find_migrations()

Retrieves list of available migration scripts

  • Visibility: public

_get_migration_number

string CI_Migration::_get_migration_number(string $migration)

Extracts the migration number from a filename

  • Visibility: protected

Arguments

  • $migration string

_get_migration_name

string CI_Migration::_get_migration_name(string $migration)

Extracts the migration class name from a filename

  • Visibility: protected

Arguments

  • $migration string

_get_version

string CI_Migration::_get_version()

Retrieves current schema version

  • Visibility: protected

_update_version

void CI_Migration::_update_version(string $migration)

Stores the current schema version

  • Visibility: protected

Arguments

  • $migration string - <p>Migration reached</p>

__get

mixed CI_Migration::__get(string $var)

Enable the use of CI super-global

  • Visibility: public

Arguments

  • $var string
Clone this wiki locally