16 $prefix = $this->getAdapter()->getOption(
'table_prefix');
18 $duplicates = $this->fetchAll(
" 20 FROM {$prefix}datalists 21 WHERE name IN (SELECT name FROM {$prefix}config) 22 AND name NOT IN ('processed_upgrades', 'version') 26 if (!empty($duplicates)) {
27 $duplicates_array = [];
28 foreach ($duplicates as $duplicate) {
29 $duplicates_array[] = $duplicate[
'name'];
31 $duplicates =
implode(
', ', $duplicates_array);
32 throw new InstallationException(
"Found names ({$duplicates}) in datalist that also exist in config. Don't know how to merge.");
40 public function up() {
42 if (!$this->hasTable(
'datalists') || !$this->hasTable(
'config')) {
46 $prefix = $this->getAdapter()->getOption(
'table_prefix');
47 $rows = $this->fetchAll(
" 48 SELECT * FROM {$prefix}datalists 49 WHERE name NOT IN ('version') 52 foreach (
$rows as $row) {
54 if ($row[
'name'] !==
'processed_upgrades') {
55 $value = serialize($row[
'value']);
58 $this->table(
'config')->insert([[
59 'name' => $row[
'name'],
65 $this->table(
'datalists')->drop()->save();
82 if ($this->hasTable(
"datalists")) {
86 $table = $this->table(
"datalists", [
88 'primary_key' => [
"name"],
91 'collation' =>
"utf8_general_ci",
94 $table->addColumn(
'name',
'string', [
96 'limit' => MysqlAdapter::TEXT_SMALL,
99 $table->addColumn(
'value',
'text', [
101 'limit' => MysqlAdapter::TEXT_REGULAR,
Updates the basic settings for the primary site object.
Thrown when there is a major problem with the installation.
up()
Migrates legacy 2.x datalists values to config table.
down()
Recreate datalists table.
validate()
Validates that there are no duplicate names in datalist and config tables.