ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilBookingManagerDBUpdateSteps.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
27 {
28  protected \ilDBInterface $db;
29 
30  public function prepare(\ilDBInterface $db): void
31  {
32  $this->db = $db;
33  }
34 
35  public function step_1(): void
36  {
37  if (!$this->db->indexExistsByFields('booking_reservation', ['context_obj_id'])) {
38  $this->db->addIndex('booking_reservation', ['context_obj_id'], 'i5');
39  }
40  }
41 
42  public function step_2(): void
43  {
44  if (!$this->db->indexExistsByFields('booking_schedule', ['pool_id'])) {
45  $this->db->addIndex('booking_schedule', ['pool_id'], 'i1');
46  }
47  }
48 
49  public function step_3(): void
50  {
51  if (!$this->db->indexExistsByFields('booking_object', ['schedule_id'])) {
52  $this->db->addIndex('booking_object', ['schedule_id'], 'i2');
53  }
54  }
55 
56  public function step_4() : void
57  {
58  $db = $this->db;
59  if (!$db->tableExists("book_sel_object")) {
60  $fields = array(
61  "user_id" => array(
62  "type" => "integer",
63  "notnull" => true,
64  "length" => 4,
65  "default" => 0
66  ),
67  "object_id" => array(
68  "type" => "integer",
69  "notnull" => true,
70  "length" => 4,
71  "default" => 0
72  )
73  );
74  $db->createTable("book_sel_object", $fields);
75  $db->addPrimaryKey("book_sel_object", ["user_id", "object_id"]);
76  }
77  }
78 
79  public function step_5() : void
80  {
81  $db = $this->db;
82  if (!$db->tableColumnExists("book_sel_object", "pool_id")) {
83  $db->addTableColumn("book_sel_object", "pool_id", [
84  "type" => "integer",
85  "notnull" => true,
86  "length" => 4,
87  "default" => 0
88  ]);
89  }
90  }
91 
92  public function step_6() : void
93  {
94  $db = $this->db;
95  if (!$db->tableColumnExists("booking_settings", "messages")) {
96  $db->addTableColumn("booking_settings", "messages", [
97  "type" => "integer",
98  "notnull" => true,
99  "length" => 4,
100  "default" => 0
101  ]);
102  }
103  }
104 
105  public function step_7() : void
106  {
107  $db = $this->db;
108  if (!$db->tableColumnExists("booking_reservation", "message")) {
109  $db->addTableColumn("booking_reservation", "message", [
110  "type" => "text",
111  "notnull" => true,
112  "length" => 4000,
113  "default" => ""
114  ]);
115  }
116  }
117 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addTableColumn(string $table_name, string $column_name, array $attributes)
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.Agent.php:21