ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDataCollectionDBUpdateSteps11.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected ilDBInterface $db;
24
25 public function prepare(ilDBInterface $db): void
26 {
27 $this->db = $db;
28 }
29
30 public function step_1(): void
31 {
32 if ($this->db->tableColumnExists('il_dcl_field', 'is_unique')) {
33 $st = $this->db->queryF(
34 'SELECT id FROM il_dcl_field WHERE is_unique = %s AND datatype_id IN (%s, %s, %s, %s)',
35 [
41 ],
42 [
43 1,
48 ]
49 );
50 while ($row = $this->db->fetchAssoc($st)) {
51 $this->db->insert(
52 'il_dcl_field_prop',
53 [
54 "id" => [ilDBConstants::T_INTEGER, $this->db->nextId('il_dcl_field_prop')],
55 "field_id" => [ilDBConstants::T_INTEGER, (int) $row['id']],
57 "value" => [ilDBConstants::T_TEXT, '1'],
58 ]
59 );
60 }
61 $this->db->dropTableColumn('il_dcl_field', 'is_unique');
62 }
63 }
64
65 public function step_2(): void
66 {
67 if (!$this->db->tableColumnExists('il_dcl_tableview', 'role_limitation')) {
68 $this->db->addTableColumn('il_dcl_tableview', 'role_limitation', [
70 'length' => 1,
71 'notnull' => true,
72 'default' => 0
73 ]);
74 $this->db->manipulateF('UPDATE il_dcl_tableview SET role_limitation = %s', [ilDBConstants::T_INTEGER], [1]);
75 }
76 }
77
78 public function step_3(): void
79 {
80 $query = 'SELECT id FROM il_dcl_datatype WHERE id = %s';
81 if ($this->db->fetchAssoc($this->db->queryF($query, [ilDBConstants::T_INTEGER], [ilDclDatatype::INPUTFORMAT_DATETIME])) === null) {
82 $this->db->insert('il_dcl_datatype', [
84 'title' => [ilDBConstants::T_TEXT, 'datetime'],
85 'storage_location' => [ilDBConstants::T_INTEGER, 3],
86 'sort' => [ilDBConstants::T_INTEGER, 52],
87 ]);
88 }
89 if ($this->db->fetchAssoc($this->db->queryF($query, [ilDBConstants::T_INTEGER], [ilDclDatatype::INPUTFORMAT_DATETIME_SELECTION])) === null) {
90 $this->db->insert('il_dcl_datatype', [
92 'title' => [ilDBConstants::T_TEXT, 'datetime_selection'],
93 'storage_location' => [ilDBConstants::T_INTEGER, 1],
94 'sort' => [ilDBConstants::T_INTEGER, 54],
95 ]);
96 }
97 }
98
99 public function step_4(): void
100 {
101 if (!$this->db->tableExists('il_dcl_notification')) {
102 $this->db->createTable('il_dcl_notification', [
103 'obj_id' => [
104 'type' => 'integer',
105 'length' => 4,
106 'notnull' => true
107 ],
108 'usr_id' => [
109 'type' => 'integer',
110 'length' => 4,
111 'notnull' => true
112 ],
113 'setting' => [
114 'type' => 'integer',
115 'length' => 4,
116 'notnull' => true
117 ],
118 ]);
119 $this->db->addPrimaryKey('il_dcl_notification', ['obj_id', 'usr_id', 'setting']);
120 }
121 }
122}
const INPUTFORMAT_TEXT_SELECTION
const INPUTFORMAT_DATETIME_SELECTION
const INPUTFORMAT_DATE_SELECTION
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...