class Migrate

Helper class for migration related console commands.

Constants

MIGRATIONS_PATH

Path to database migration files.

Methods

static bool
batchExists(int $batch)

Test if a particular batch of migrations exists.

static int
dropAllTables()

Drops all tables from the database without using down function.

static string
fileNameTime()

Generates time stamp for migrations in following format: yyyymmddhhmmss.

static int
generateACLTableMigration()

Generates migration for acl table.

static int
generateAllMigrations()

Generates all migrations.

static int
generateEmailAttachmentsTableMigration()

Generates migration for email_attachments table.

static int
generateMigrationByName(InputInterface $input)

Generates migration by name.

static int
generateMigrationsTableMigration()

Generates migration for migration table.

static int
generateProfileImagesTableMigration()

Generates migration for profile_images table.

static int
generateUserSessionsTableMigration()

Generates migration for user_sessions table.

static int
generateUsersTableMigration()

Generates migration for users table.

static int
makeMigration(InputInterface $input)

Generates a migration class for creating a new table.

static int
makeRenameMigration(InputInterface $input)

Generates a migration class for renaming an existing table.

static int
makeUpdateMigration(InputInterface $input)

Generates a migration class for updating existing table.

static int
migrate()

Performs migration operation.

static int
refresh(bool|int $step = false)

Performs refresh operation.

static int
rollback(string|int|bool $batch = false)

Performs roll back operation

static int
rollbackStep(string|int $step)

Perform step roll back.

static int
status()

Reports migration status.

static bool|int
step(string $klassNamespace, bool|int $step = false)

Drops table one at a time.

static int
tableCount()

Determines number of tables in database before performing migration operations.

Details

at line 31
static private bool batchExists(int $batch)

Test if a particular batch of migrations exists.

Parameters

int $batch

The batch value we want to test if it exists.

Return Value

bool

true if exists, otherwise we return false.

at line 45
static int dropAllTables()

Drops all tables from the database without using down function.

Return Value

int

A value that indicates success, invalid, or failure.

at line 78
static string fileNameTime()

Generates time stamp for migrations in following format: yyyymmddhhmmss.

Return Value

string

The migration timestamp.

at line 87
static int generateACLTableMigration()

Generates migration for acl table.

Return Value

int

A value that indicates success, invalid, or failure.

at line 101
static int generateAllMigrations()

Generates all migrations.

Return Value

int Command::SUCCESS

at line 115
static int generateEmailAttachmentsTableMigration()

Generates migration for email_attachments table.

Return Value

int

A value that indicates success, invalid, or failure.

at line 130
static int generateMigrationByName(InputInterface $input)

Generates migration by name.

Parameters

InputInterface $input

The Symfony InputInterface object.

Return Value

int Command::SUCCESS

at line 145
static int generateMigrationsTableMigration()

Generates migration for migration table.

Return Value

int

A value that indicates success, invalid, or failure.

at line 159
static int generateProfileImagesTableMigration()

Generates migration for profile_images table.

Return Value

int

A value that indicates success, invalid, or failure.

at line 173
static int generateUserSessionsTableMigration()

Generates migration for user_sessions table.

Return Value

int

A value that indicates success, invalid, or failure.

at line 187
static int generateUsersTableMigration()

Generates migration for users table.

Return Value

int

A value that indicates success, invalid, or failure.

at line 202
static int makeMigration(InputInterface $input)

Generates a migration class for creating a new table.

Parameters

InputInterface $input

The Symfony InputInterface object.

Return Value

int

A value that indicates success, invalid, or failure.

at line 220
static int makeRenameMigration(InputInterface $input)

Generates a migration class for renaming an existing table.

Parameters

InputInterface $input

The Symfony InputInterface object.

Return Value

int

A value that indicates success, invalid, or failure.

at line 239
static int makeUpdateMigration(InputInterface $input)

Generates a migration class for updating existing table.

Parameters

InputInterface $input

The Symfony InputInterface object.

Return Value

int

A value that indicates success, invalid, or failure.

at line 256
static int migrate()

Performs migration operation.

Return Value

int

A value that indicates success, invalid, or failure.

at line 328
static int refresh(bool|int $step = false)

Performs refresh operation.

Parameters

bool|int $step

The number of individual migrations to roll back. When set to false all tables are dropped one by one.

Return Value

int

A value that indicates success, invalid, or failure.

at line 383
static int rollback(string|int|bool $batch = false)

Performs roll back operation

Parameters

string|int|bool $batch

The batch number. If false we assume that we want to roll back latest batch of migrations.

Return Value

int

A value that indicates success, invalid, or failure.

at line 431
static int rollbackStep(string|int $step)

Perform step roll back.

Parameters

string|int $step

Return Value

int

A value that indicates success, invalid, or failure.

at line 444
static int status()

Reports migration status.

Return Value

int

A value that indicates success, invalid, or failure.

at line 500
static private bool|int step(string $klassNamespace, bool|int $step = false)

Drops table one at a time.

Parameters

string $klassNamespace

The name of the migration class.

bool|int $step

The number of individual migrations to roll back. When set to false all tables are dropped one by one.

Return Value

bool|int

$step The number of remaining steps to perform with respect to rolling back migrations. Boolean value of false is returned when no number of steps is provided.

at line 521
static private int tableCount()

Determines number of tables in database before performing migration operations.

Return Value

int

The number of tables in the database.