weekly release 3.3dev
[moodle.git] / mod / data / db / upgrade.php
CommitLineData
1adbd2c3 1<?php
aab98aaf 2// This file keeps track of upgrades to
b8a342d7 3// the data module
4//
5// Sometimes, changes between versions involve
6// alterations to database structures and other
7// major things that may break installations.
8//
9// The upgrade function in this file will attempt
10// to perform all the necessary actions to upgrade
2e0406a5 11// your older installation to the current version.
b8a342d7 12//
13// If there's something it cannot do itself, it
14// will tell you what you need to do.
15//
16// The commands in here will all be database-neutral,
b1f93b15 17// using the methods of database_manager class
775f811a 18//
19// Please do not forget to use upgrade_set_timeout()
20// before any action that may take longer time to finish.
b8a342d7 21
e8c82aac
EL
22defined('MOODLE_INTERNAL') || die();
23
775f811a 24function xmldb_data_upgrade($oldversion) {
e8c82aac 25 global $CFG, $DB;
b8a342d7 26
f33e1ed4 27 $dbman = $DB->get_manager();
25322ba3 28
1c3b2058
JO
29 // Moodle v2.8.0 release upgrade line.
30 // Put any upgrade step following this.
31
25ffb8d5 32 if ($oldversion < 2015030900) {
b89cca19
DW
33 // Define field required to be added to data_fields.
34 $table = new xmldb_table('data_fields');
35 $field = new xmldb_field('required', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'description');
36
37 // Conditionally launch add field required.
38 if (!$dbman->field_exists($table, $field)) {
39 $dbman->add_field($table, $field);
40 }
41
25ffb8d5 42 upgrade_mod_savepoint(true, 2015030900, 'data');
b89cca19 43 }
f94891cc 44
b758ab30
EL
45 // Moodle v2.9.0 release upgrade line.
46 // Put any upgrade step following this.
47
0730ddc2 48 if ($oldversion < 2015092200) {
97fe80ad
JB
49
50 // Define field manageapproved to be added to data.
51 $table = new xmldb_table('data');
52 $field = new xmldb_field('manageapproved', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '1', 'approval');
53
54 // Conditionally launch add field manageapproved.
55 if (!$dbman->field_exists($table, $field)) {
56 $dbman->add_field($table, $field);
57 }
58
59 // Data savepoint reached.
0730ddc2 60 upgrade_mod_savepoint(true, 2015092200, 'data');
97fe80ad
JB
61 }
62
6d29c4ac
EL
63 // Moodle v3.0.0 release upgrade line.
64 // Put any upgrade step following this.
65
b174e9ef
DP
66 if ($oldversion < 2016030300) {
67
68 // Define field timemodified to be added to data.
69 $table = new xmldb_table('data');
70 $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'notification');
71
72 // Conditionally launch add field timemodified.
73 if (!$dbman->field_exists($table, $field)) {
74 $dbman->add_field($table, $field);
75 }
76
77 // Data savepoint reached.
78 upgrade_mod_savepoint(true, 2016030300, 'data');
79 }
80
81
4da854a6
EL
82 // Moodle v3.1.0 release upgrade line.
83 // Put any upgrade step following this.
84
4e2e54ee
AN
85 if ($oldversion < 2016090600) {
86
87 // Define field config to be added to data.
88 $table = new xmldb_table('data');
89 $field = new xmldb_field('config', XMLDB_TYPE_TEXT, null, null, null, null, null, 'timemodified');
90
91 // Conditionally launch add field config.
92 if (!$dbman->field_exists($table, $field)) {
93 $dbman->add_field($table, $field);
94 }
95
96 // Data savepoint reached.
97 upgrade_mod_savepoint(true, 2016090600, 'data');
98 }
99
75c57a08
EL
100 // Automatically generated Moodle v3.2.0 release upgrade line.
101 // Put any upgrade step following this.
102
a4cdd6d2 103 return true;
b8a342d7 104}