ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilBookingManagerDBUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 protected \ilDBInterface $db;
26
27 public function prepare(\ilDBInterface $db): void
28 {
29 $this->db = $db;
30 }
31
32 public function step_1(): void
33 {
34 if (!$this->db->indexExistsByFields('booking_reservation', ['context_obj_id'])) {
35 $this->db->addIndex('booking_reservation', ['context_obj_id'], 'i5');
36 }
37 }
38
39 public function step_2(): void
40 {
41 if (!$this->db->indexExistsByFields('booking_schedule', ['pool_id'])) {
42 $this->db->addIndex('booking_schedule', ['pool_id'], 'i1');
43 }
44 }
45
46 public function step_3(): void
47 {
48 if (!$this->db->indexExistsByFields('booking_object', ['schedule_id'])) {
49 $this->db->addIndex('booking_object', ['schedule_id'], 'i2');
50 }
51 }
52
53 public function step_4(): void
54 {
55 $db = $this->db;
56 if (!$db->tableExists("book_sel_object")) {
57 $fields = array(
58 "user_id" => array(
59 "type" => "integer",
60 "notnull" => true,
61 "length" => 4,
62 "default" => 0
63 ),
64 "object_id" => array(
65 "type" => "integer",
66 "notnull" => true,
67 "length" => 4,
68 "default" => 0
69 )
70 );
71 $db->createTable("book_sel_object", $fields);
72 $db->addPrimaryKey("book_sel_object", ["user_id", "object_id"]);
73 }
74 }
75
76 public function step_5(): void
77 {
78 $db = $this->db;
79 if (!$db->tableColumnExists("book_sel_object", "pool_id")) {
80 $db->addTableColumn("book_sel_object", "pool_id", [
81 "type" => "integer",
82 "notnull" => true,
83 "length" => 4,
84 "default" => 0
85 ]);
86 }
87 }
88
89 public function step_6(): void
90 {
91 $db = $this->db;
92 if (!$db->tableColumnExists("booking_settings", "messages")) {
93 $db->addTableColumn("booking_settings", "messages", [
94 "type" => "integer",
95 "notnull" => true,
96 "length" => 4,
97 "default" => 0
98 ]);
99 }
100 }
101
102 public function step_7(): void
103 {
104 $db = $this->db;
105 if (!$db->tableColumnExists("booking_reservation", "message")) {
106 $db->addTableColumn("booking_reservation", "message", [
107 "type" => "text",
108 "notnull" => true,
109 "length" => 4000,
110 "default" => ""
111 ]);
112 }
113 }
114
115 public function step_8(): void
116 {
117 if (!$this->db->tableColumnExists('booking_object', 'obj_info_rid')) {
118 $this->db->addTableColumn(
119 'booking_object',
120 'obj_info_rid',
121 [
122 'type' => 'text',
123 'notnull' => false,
124 'length' => 64,
125 'default' => null
126 ]
127 );
128 }
129 }
130
131 public function step_9(): void
132 {
133 if (!$this->db->tableColumnExists('booking_object', 'book_info_rid')) {
134 $this->db->addTableColumn(
135 'booking_object',
136 'book_info_rid',
137 [
138 'type' => 'text',
139 'notnull' => false,
140 'length' => 64,
141 'default' => null
142 ]
143 );
144 }
145 }
146
147}
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
Interface ilDBInterface.
addTableColumn(string $table_name, string $column_name, array $attributes)
tableExists(string $table_name)
tableColumnExists(string $table_name, string $column_name)
createTable(string $table_name, array $fields, bool $drop_table=false, bool $ignore_erros=false)
addPrimaryKey(string $table_name, array $primary_keys)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...