DatabaseUpdateBase

Base class for database migration, inspired by Yii.

See more info in README file in same folder.

package

Default

Methods

__construct

__construct(\CDbConnection $connection,string $options)

Arguments

$connection

\CDbConnection

$options

string

Specific database options like ENGINE=INNODB etc

Get db version number based on class name, e.g. 123 for Update_123

getVersion(): integer

Response

integer

Runs up() wrapped in a transaction.

safeUp(): void

Will rollback transaction and re-throw exception at failure.

Throws
\Throwable

This is the function that must be implemented by the child classes.

up()
abstract

Sets DBVersion in settings global to $this->newVersion Last thing that happens before transaction commit in every update.

updateVersion()

Properties

db

db :\CDbConnection
var

Type(s)

\CDbConnection

newVersion

newVersion :integer
var

Type(s)

integer

options

options :string
var

Type(s)

string