13 if (!$this->hasTable(
'entity_subtypes')) {
17 $reserved_subtypes = [
29 $prefix = $this->getAdapter()->getOption(
'table_prefix');
32 $subtypes_in = array_map(
function ($e) {
36 $subtypes_in =
implode(
', ', $subtypes_in);
38 $row = $this->fetchRow(
" 39 SELECT count(*) as count 40 FROM {$prefix}entity_subtypes 42 AND subtype IN ($subtypes_in) 45 if (!empty($row[
'count'])) {
48 Unable to perform migration {$class}, because the database contains entities with a reserved subtype name. 49 Please ensure that you are not using one of the reserved subtypes [{$subtypes_in}] 50 for entities of '{$type}' type before running the migration, 51 otherwise you may loose important entity subtype bindings. 56 $row = $this->fetchRow(
" 57 SELECT count(*) as count 58 FROM {$prefix}entities 60 AND subtype=0 OR subtype IS NULL 63 if (!empty($row[
'count'])) {
66 Unable to perform migration {$class}, because the database contains objects without a subtype. 67 Please ensure that all object entities have a valid subtype associated with them. 68 There are {$row->count} object without a subtype in your entities table. 80 $prefix = $this->getAdapter()->getOption(
'table_prefix');
82 $table = $this->table(
'entities');
84 $table->renameColumn(
'subtype',
'subtype_id');
87 $table->addColumn(
'subtype',
'string', [
96 UPDATE {$prefix}entities e 97 JOIN {$prefix}entity_subtypes es ON e.subtype_id = es.id 98 SET e.subtype = es.subtype 101 foreach ([
'user',
'group',
'site'] as
$type) {
103 UPDATE {$prefix}entities e 104 SET e.subtype = '{$type}' 105 WHERE e.type = '{$type}' AND e.subtype_id = 0 109 $table->removeColumn(
'subtype_id');
113 $this->table(
'entity_subtypes')->drop()->save();
Updates the basic settings for the primary site object.
Thrown when there is a major problem with the installation.
validate()
Validate that migration is possible.