ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLTIDatabaseUpdateSteps.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('lti2_consumer', 'consumer_key')) {
33 $this->db->dropTableColumn('lti2_consumer', 'consumer_key');
34 }
35 }
36
37 public function step_2(): void
38 {
39 if ($this->db->tableColumnExists('lti2_consumer', 'consumer_key256')) {
40 $this->db->renameTableColumn('lti2_consumer', 'consumer_key256', 'consumer_key');
41 }
42 }
43
44 public function step_3(): void
45 {
46 if ($this->db->tableColumnExists('lti2_consumer', 'consumer_key')) {
47 $this->db->modifyTableColumn('lti2_consumer', 'consumer_key', array(
48 'type' => 'text',
49 'length' => 255,
50 'notnull' => false
51 ));
52 }
53 }
54
55 public function step_4(): void
56 {
57 if (!$this->db->tableColumnExists('lti2_consumer', 'platform_id')) {
58 $this->db->addTableColumn('lti2_consumer', 'platform_id', [
59 'type' => 'text',
60 'length' => 255,
61 'notnull' => false
62 ]);
63 }
64 }
65
66 public function step_5(): void
67 {
68 if (!$this->db->tableColumnExists('lti2_consumer', 'client_id')) {
69 $this->db->addTableColumn('lti2_consumer', 'client_id', [
70 'type' => 'text',
71 'length' => 255,
72 'notnull' => false
73 ]);
74 }
75 }
76
77 public function step_6(): void
78 {
79 if (!$this->db->tableColumnExists('lti2_consumer', 'deployment_id')) {
80 $this->db->addTableColumn('lti2_consumer', 'deployment_id', [
81 'type' => 'text',
82 'length' => 255,
83 'notnull' => false
84 ]);
85 }
86 }
87
88 public function step_7(): void
89 {
90 if (!$this->db->tableColumnExists('lti2_consumer', 'public_key')) {
91 $this->db->addTableColumn('lti2_consumer', 'public_key', [
92 'type' => 'clob',
93 'notnull' => false
94 ]);
95 }
96 }
97
98 public function step_8(): void
99 {
100 if (!$this->db->tableExists('lti2_access_token')) {
101 $values = array(
102 'consumer_pk' => array(
103 'type' => 'integer',
104 'length' => 4,
105 'notnull' => true
106 ),
107 'scopes' => array(
108 'type' => 'clob',
109 'default' => '',
110 'notnull' => true
111 ),
112 'token' => array(
113 'type' => 'text',
114 'length' => 2000,
115 'default' => '',
116 'notnull' => true
117 ),
118 'expires' => array(
119 'type' => 'timestamp',
120 'notnull' => true
121 ),
122 'created' => array(
123 'type' => 'timestamp',
124 'notnull' => true
125 ),
126 'updated' => array(
127 'type' => 'timestamp',
128 'notnull' => true
129 )
130 );
131 $this->db->createTable("lti2_access_token", $values);
132 $this->db->addPrimaryKey("lti2_access_token", array("consumer_pk"));
133 }
134 }
135
136 public function step_9(): void
137 {
138 $this->db->modifyTableColumn("lti2_consumer", "settings", array("type" => "clob", "notnull" => false));
139 }
140}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...