ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMDLOMUpdateSteps.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  protected \ilDBInterface $db;
24 
25  public function prepare(\ilDBInterface $db): void
26  {
27  $this->db = $db;
28  }
29 
34  public function step_1(): void
35  {
36  if (!$this->db->tableColumnExists('il_meta_general', 'general_aggl')) {
37  $this->db->addTableColumn(
38  'il_meta_general',
39  'general_aggl',
40  [
41  'type' => ilDBConstants::T_TEXT,
42  'length' => 16,
43  ]
44  );
45  }
46  }
47 
52  public function step_2(): void
53  {
54  if (!$this->db->tableColumnExists('il_meta_contribute', 'c_date_descr')) {
55  $this->db->addTableColumn(
56  'il_meta_contribute',
57  'c_date_descr',
58  [
59  'type' => ilDBConstants::T_CLOB,
60  ]
61  );
62  }
63  if (!$this->db->tableColumnExists('il_meta_contribute', 'descr_lang')) {
64  $this->db->addTableColumn(
65  'il_meta_contribute',
66  'descr_lang',
67  [
68  'type' => ilDBConstants::T_TEXT,
69  'length' => 2
70  ]
71  );
72  }
73  }
74 
79  public function step_3(): void
80  {
81  if (!$this->db->tableColumnExists('il_meta_annotation', 'a_date_descr')) {
82  $this->db->addTableColumn(
83  'il_meta_annotation',
84  'a_date_descr',
85  [
86  'type' => ilDBConstants::T_CLOB,
87  ]
88  );
89  }
90  if (!$this->db->tableColumnExists('il_meta_annotation', 'date_descr_lang')) {
91  $this->db->addTableColumn(
92  'il_meta_annotation',
93  'date_descr_lang',
94  [
95  'type' => ilDBConstants::T_TEXT,
96  'length' => 2
97  ]
98  );
99  }
100  }
101 
106  public function step_4(): void
107  {
108  if (!$this->db->tableColumnExists('il_meta_educational', 'tlt_descr')) {
109  $this->db->addTableColumn(
110  'il_meta_educational',
111  'tlt_descr',
112  [
113  'type' => ilDBConstants::T_CLOB,
114  ]
115  );
116  }
117  if (!$this->db->tableColumnExists('il_meta_educational', 'tlt_descr_lang')) {
118  $this->db->addTableColumn(
119  'il_meta_educational',
120  'tlt_descr_lang',
121  [
122  'type' => ilDBConstants::T_TEXT,
123  'length' => 2
124  ]
125  );
126  }
127  }
128 
133  public function step_5(): void
134  {
135  if (!$this->db->tableColumnExists('il_meta_technical', 'duration_descr')) {
136  $this->db->addTableColumn(
137  'il_meta_technical',
138  'duration_descr',
139  [
140  'type' => ilDBConstants::T_CLOB,
141  ]
142  );
143  }
144  if (!$this->db->tableColumnExists('il_meta_technical', 'duration_descr_lang')) {
145  $this->db->addTableColumn(
146  'il_meta_technical',
147  'duration_descr_lang',
148  [
149  'type' => ilDBConstants::T_TEXT,
150  'length' => 2
151  ]
152  );
153  }
154  }
155 
159  public function step_6(): void
160  {
161  if (!$this->db->tableExists('il_meta_coverage')) {
162  $this->db->createTable(
163  'il_meta_coverage',
164  [
165  'meta_coverage_id' => [
166  'type' => ilDBConstants::T_INTEGER,
167  'notnull' => true,
168  'default' => 0
169  ],
170  'rbac_id' => [
171  'type' => ilDBConstants::T_INTEGER,
172  ],
173  'obj_id' => [
174  'type' => ilDBConstants::T_INTEGER,
175  ],
176  'obj_type' => [
177  'type' => ilDBConstants::T_TEXT,
178  'length' => 6
179  ],
180  'parent_type' => [
181  'type' => ilDBConstants::T_TEXT,
182  'length' => 16
183  ],
184  'parent_id' => [
185  'type' => ilDBConstants::T_INTEGER,
186  ],
187  'coverage' => [
188  'type' => ilDBConstants::T_TEXT,
189  'length' => 4000
190  ],
191  'coverage_language' => [
192  'type' => ilDBConstants::T_TEXT,
193  'length' => 2,
194  'fixed' => true
195  ]
196  ]
197  );
198 
199  $this->db->createSequence('il_meta_coverage');
200  $this->db->addPrimaryKey('il_meta_coverage', ['meta_coverage_id']);
201  }
202  }
203 
207  public function step_7(): void
208  {
209  if (!$this->db->tableExists('il_meta_meta_schema')) {
210  $this->db->createTable(
211  'il_meta_meta_schema',
212  [
213  'meta_meta_schema_id' => [
214  'type' => ilDBConstants::T_INTEGER,
215  'notnull' => true,
216  'default' => 0
217  ],
218  'rbac_id' => [
219  'type' => ilDBConstants::T_INTEGER,
220  ],
221  'obj_id' => [
222  'type' => ilDBConstants::T_INTEGER,
223  ],
224  'obj_type' => [
225  'type' => ilDBConstants::T_TEXT,
226  'length' => 6
227  ],
228  'parent_type' => [
229  'type' => ilDBConstants::T_TEXT,
230  'length' => 16
231  ],
232  'parent_id' => [
233  'type' => ilDBConstants::T_INTEGER,
234  ],
235  'meta_data_schema' => [
236  'type' => ilDBConstants::T_TEXT,
237  'length' => 16
238  ]
239  ]
240  );
241 
242  $this->db->createSequence('il_meta_meta_schema');
243  $this->db->addPrimaryKey('il_meta_meta_schema', ['meta_meta_schema_id']);
244  }
245  }
246 
250  public function step_8(): void
251  {
252  if (!$this->db->tableExists('il_meta_or_composite')) {
253  $this->db->createTable(
254  'il_meta_or_composite',
255  [
256  'meta_or_composite_id' => [
257  'type' => ilDBConstants::T_INTEGER,
258  'notnull' => true,
259  'default' => 0
260  ],
261  'rbac_id' => [
262  'type' => ilDBConstants::T_INTEGER,
263  ],
264  'obj_id' => [
265  'type' => ilDBConstants::T_INTEGER,
266  ],
267  'obj_type' => [
268  'type' => ilDBConstants::T_TEXT,
269  'length' => 6
270  ],
271  'parent_type' => [
272  'type' => ilDBConstants::T_TEXT,
273  'length' => 16
274  ],
275  'parent_id' => [
276  'type' => ilDBConstants::T_INTEGER,
277  ],
278  'type' => [
279  'type' => ilDBConstants::T_TEXT,
280  'length' => 16
281  ],
282  'name' => [
283  'type' => ilDBConstants::T_TEXT,
284  'length' => 32
285  ],
286  'min_version' => [
287  'type' => ilDBConstants::T_TEXT,
288  'length' => 255
289  ],
290  'max_version' => [
291  'type' => ilDBConstants::T_TEXT,
292  'length' => 255
293  ]
294  ]
295  );
296 
297  $this->db->createSequence('il_meta_or_composite');
298  $this->db->addPrimaryKey('il_meta_or_composite', ['meta_or_composite_id']);
299  }
300  }
301 
305  public function step_9(): void
306  {
307  if (!$this->db->tableExists('il_meta_lr_type')) {
308  $this->db->createTable(
309  'il_meta_lr_type',
310  [
311  'meta_lr_type_id' => [
312  'type' => ilDBConstants::T_INTEGER,
313  'notnull' => true,
314  'default' => 0
315  ],
316  'rbac_id' => [
317  'type' => ilDBConstants::T_INTEGER,
318  ],
319  'obj_id' => [
320  'type' => ilDBConstants::T_INTEGER,
321  ],
322  'obj_type' => [
323  'type' => ilDBConstants::T_TEXT,
324  'length' => 6
325  ],
326  'parent_type' => [
327  'type' => ilDBConstants::T_TEXT,
328  'length' => 16
329  ],
330  'parent_id' => [
331  'type' => ilDBConstants::T_INTEGER,
332  ],
333  'learning_resource_type' => [
334  'type' => ilDBConstants::T_TEXT,
335  'length' => 32
336  ]
337  ]
338  );
339 
340  $this->db->createSequence('il_meta_lr_type');
341  $this->db->addPrimaryKey('il_meta_lr_type', ['meta_lr_type_id']);
342  }
343  }
344 
348  public function step_10(): void
349  {
350  if (!$this->db->tableExists('il_meta_end_usr_role')) {
351  $this->db->createTable(
352  'il_meta_end_usr_role',
353  [
354  'meta_end_usr_role_id' => [
355  'type' => ilDBConstants::T_INTEGER,
356  'notnull' => true,
357  'default' => 0
358  ],
359  'rbac_id' => [
360  'type' => ilDBConstants::T_INTEGER,
361  ],
362  'obj_id' => [
363  'type' => ilDBConstants::T_INTEGER,
364  ],
365  'obj_type' => [
366  'type' => ilDBConstants::T_TEXT,
367  'length' => 6
368  ],
369  'parent_type' => [
370  'type' => ilDBConstants::T_TEXT,
371  'length' => 16
372  ],
373  'parent_id' => [
374  'type' => ilDBConstants::T_INTEGER,
375  ],
376  'intended_end_user_role' => [
377  'type' => ilDBConstants::T_TEXT,
378  'length' => 16
379  ]
380  ]
381  );
382 
383  $this->db->createSequence('il_meta_end_usr_role');
384  $this->db->addPrimaryKey('il_meta_end_usr_role', ['meta_end_usr_role_id']);
385  }
386  }
387 
391  public function step_11(): void
392  {
393  if (!$this->db->tableExists('il_meta_context')) {
394  $this->db->createTable(
395  'il_meta_context',
396  [
397  'meta_context_id' => [
398  'type' => ilDBConstants::T_INTEGER,
399  'notnull' => true,
400  'default' => 0
401  ],
402  'rbac_id' => [
403  'type' => ilDBConstants::T_INTEGER,
404  ],
405  'obj_id' => [
406  'type' => ilDBConstants::T_INTEGER,
407  ],
408  'obj_type' => [
409  'type' => ilDBConstants::T_TEXT,
410  'length' => 6
411  ],
412  'parent_type' => [
413  'type' => ilDBConstants::T_TEXT,
414  'length' => 16
415  ],
416  'parent_id' => [
417  'type' => ilDBConstants::T_INTEGER,
418  ],
419  'context' => [
420  'type' => ilDBConstants::T_TEXT,
421  'length' => 16
422  ]
423  ]
424  );
425 
426  $this->db->createSequence('il_meta_context');
427  $this->db->addPrimaryKey('il_meta_context', ['meta_context_id']);
428  }
429  }
430 }
step_3()
Add two columns to the il_meta_annotation table to store the description of the date and its language...
step_8()
Add a new table for the non-unique or-composite in requirements.
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
step_11()
Add a new table for the non-unique context.
step_2()
Add two columns to the il_meta_contribute table to store the descrption of the date and its language...
step_4()
Add two columns to the il_meta_educational table to store the description of the typical learning tim...
step_1()
Add a column to the il_meta_general table to store the &#39;Aggregation Level&#39; element.
step_5()
Add two columns to the il_meta_technical table to store the description of the duration and its langu...
step_6()
Add a new table for the non-unique coverage.
step_9()
Add a new table for the non-unique learning resource type.
step_7()
Add a new table for the non-unique metadata schema.
step_10()
Add a new table for the non-unique intented end user role.