Update_709
extends DatabaseUpdateBase
in package
Base class for database migration, inspired by Yii.
See more info in README file in same folder.
Table of Contents
Properties
- $db : CDbConnection
- $newVersion : int
- $options : string
Methods
- __construct() : mixed
- getVersion() : int
- Get db version number based on class name, e.g. 123 for Update_123
- safeUp() : void
- Runs up() wrapped in a transaction.
- up() : mixed
- Adjust ranking questions to be of JSON type
- alter() : void
- Alters table by adding a new JSON field, updating it with values and removing the original fields
- alterMySQL() : void
- Alters MySQL table by adding a new JSON field, updating it with values and removing the original fields
- alterPostgreSQL() : void
- Alters PostgreSQL table by adding a new JSON field, updating it with values and removing the original fields
- alterSQLServer() : void
- Alters SQL Server table by adding a new JSON field, updating it with values and removing the original fields
- updateRankingSubQuestionTypes() : void
- Updates sub-questions of ranking questions from type 'T' to type 'R'.
- updateRankingSubQuestionTypesMySQL() : void
- Updates MySQL sub-questions of ranking questions from type 'T' to type 'R'
- updateRankingSubQuestionTypesPostgreSQL() : void
- Updates PostgreSQL sub-questions of ranking questions from type 'T' to type 'R'
- updateRankingSubQuestionTypesSQLServer() : void
- Updates SQLServer sub-questions of ranking questions from type 'T' to type 'R'
- updateVersion() : mixed
- Sets DBVersion in settings global to $this->newVersion Last thing that happens before transaction commit in every update.
Properties
$db
protected
CDbConnection
$db
$newVersion
protected
int
$newVersion
$options
protected
string
$options
Methods
__construct()
public
__construct(CDbConnection $connection, string $options) : mixed
Parameters
- $connection : CDbConnection
- $options : string
-
Specific database options like ENGINE=INNODB etc
getVersion()
Get db version number based on class name, e.g. 123 for Update_123
public
getVersion() : int
Return values
intsafeUp()
Runs up() wrapped in a transaction.
public
safeUp() : void
Will rollback transaction and re-throw exception at failure.
Tags
up()
Adjust ranking questions to be of JSON type
public
up() : mixed
Tags
alter()
Alters table by adding a new JSON field, updating it with values and removing the original fields
protected
alter(int $sid, int $parent_qid, array<string|int, mixed> $cols) : void
Parameters
- $sid : int
- $parent_qid : int
- $cols : array<string|int, mixed>
alterMySQL()
Alters MySQL table by adding a new JSON field, updating it with values and removing the original fields
protected
alterMySQL(int $sid, int $parent_qid, array<string|int, mixed> $cols) : void
Parameters
- $sid : int
- $parent_qid : int
- $cols : array<string|int, mixed>
alterPostgreSQL()
Alters PostgreSQL table by adding a new JSON field, updating it with values and removing the original fields
protected
alterPostgreSQL(int $sid, int $parent_qid, array<string|int, mixed> $cols) : void
Parameters
- $sid : int
- $parent_qid : int
- $cols : array<string|int, mixed>
alterSQLServer()
Alters SQL Server table by adding a new JSON field, updating it with values and removing the original fields
protected
alterSQLServer(int $sid, int $parent_qid, array<string|int, mixed> $cols) : void
Parameters
- $sid : int
- $parent_qid : int
- $cols : array<string|int, mixed>
updateRankingSubQuestionTypes()
Updates sub-questions of ranking questions from type 'T' to type 'R'.
protected
updateRankingSubQuestionTypes() : void
updateRankingSubQuestionTypesMySQL()
Updates MySQL sub-questions of ranking questions from type 'T' to type 'R'
protected
updateRankingSubQuestionTypesMySQL(string $typeCol, string $rankingKey) : void
Parameters
- $typeCol : string
- $rankingKey : string
updateRankingSubQuestionTypesPostgreSQL()
Updates PostgreSQL sub-questions of ranking questions from type 'T' to type 'R'
protected
updateRankingSubQuestionTypesPostgreSQL(string $typeCol, string $rankingKey) : void
Parameters
- $typeCol : string
- $rankingKey : string
updateRankingSubQuestionTypesSQLServer()
Updates SQLServer sub-questions of ranking questions from type 'T' to type 'R'
protected
updateRankingSubQuestionTypesSQLServer(string $typeCol, string $rankingKey) : void
Parameters
- $typeCol : string
- $rankingKey : string
updateVersion()
Sets DBVersion in settings global to $this->newVersion Last thing that happens before transaction commit in every update.
private
updateVersion() : mixed