ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
TodoDBUpdateSteps.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 use ilDBInterface;
25 
27 {
28  protected ilDBInterface $db;
29 
34  public function prepare(ilDBInterface $db): void
35  {
36  $this->db = $db;
37  }
38 
44  public function step_1()
45  {
46  if (! $this->db->tableExists('todo_items')) {
47  $this->db->createTable('todo_items', [
48  'todo_id' => ['type' => 'integer', 'length' => '4', 'notnull' => true],
49  'user_id' => ['type' => 'integer', 'length' => '4', 'notnull' => true],
50  'title' => ['type' => 'text', 'length' => '250', 'notnull' => true],
51  'description' => ['type' => 'clob', 'notnull' => false],
52  'deadline' => ['type' => 'date', 'notnull' => false],
53  ]);
54 
55  $this->db->createSequence('todo_items');
56  $this->db->addPrimaryKey('todo_items', ['todo_id']);
57  $this->db->addIndex('todo_items', ['user_id'], 'i1');
58  }
59  }
60 }
prepare(ilDBInterface $db)
Prepare the update ilDBInterface should be the only dependency of the update steps.
step_1()
Step 1: Creation of the table Update steps must be consecutively numbered ILIAS setup remembers the a...