Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * tool_dataprivacy plugin upgrade code
19
 *
20
 * @package    tool_dataprivacy
21
 * @copyright  2018 Jun Pataleta
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
/**
26
 * Function to upgrade tool_dataprivacy.
27
 *
28
 * @param int $oldversion the version we are upgrading from
29
 * @return bool result
30
 */
31
function xmldb_tool_dataprivacy_upgrade($oldversion) {
32
    global $CFG, $DB;
33
 
34
    $dbman = $DB->get_manager();
35
 
36
    // Automatically generated Moodle v4.2.0 release upgrade line.
37
    // Put any upgrade step following this.
38
 
39
    if ($oldversion < 2023062700) {
40
        // Define table tool_dataprivacy_contextlist to be created.
41
        $table = new xmldb_table('tool_dataprivacy_contextlist');
42
 
43
        // Adding fields to table tool_dataprivacy_contextlist.
44
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
45
        $table->add_field('component', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
46
        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
47
        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
48
 
49
        // Adding keys to table tool_dataprivacy_contextlist.
50
        $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
51
 
52
        // Conditionally launch create table for tool_dataprivacy_contextlist.
53
        if (!$dbman->table_exists($table)) {
54
            $dbman->create_table($table);
55
        }
56
 
57
        // Define table tool_dataprivacy_ctxlst_ctx to be created.
58
        $table = new xmldb_table('tool_dataprivacy_ctxlst_ctx');
59
 
60
        // Adding fields to table tool_dataprivacy_ctxlst_ctx.
61
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
62
        $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
63
        $table->add_field('contextlistid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
64
        $table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
65
        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
66
        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
67
 
68
        // Adding keys to table tool_dataprivacy_ctxlst_ctx.
69
        $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
70
        $table->add_key('contextlistid', XMLDB_KEY_FOREIGN, ['contextlistid'], 'tool_dataprivacy_contextlist', ['id']);
71
 
72
        // Conditionally launch create table for tool_dataprivacy_ctxlst_ctx.
73
        if (!$dbman->table_exists($table)) {
74
            $dbman->create_table($table);
75
        }
76
 
77
        // Define table tool_dataprivacy_rqst_ctxlst to be created.
78
        $table = new xmldb_table('tool_dataprivacy_rqst_ctxlst');
79
 
80
        // Adding fields to table tool_dataprivacy_rqst_ctxlst.
81
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
82
        $table->add_field('requestid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
83
        $table->add_field('contextlistid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
84
 
85
        // Adding keys to table tool_dataprivacy_rqst_ctxlst.
86
        $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
87
        $table->add_key('requestid', XMLDB_KEY_FOREIGN, ['requestid'], 'tool_dataprivacy_request', ['id']);
88
        $table->add_key('contextlistid', XMLDB_KEY_FOREIGN, ['contextlistid'], 'tool_dataprivacy_contextlist', ['id']);
89
        $table->add_key('requestidcontextlistid', XMLDB_KEY_UNIQUE, ['requestid', 'contextlistid']);
90
 
91
        // Conditionally launch create table for tool_dataprivacy_rqst_ctxlst.
92
        if (!$dbman->table_exists($table)) {
93
            $dbman->create_table($table);
94
        }
95
 
96
        // Dataprivacy savepoint reached.
97
        upgrade_plugin_savepoint(true, 2023062700, 'tool', 'dataprivacy');
98
    }
99
 
100
    // Automatically generated Moodle v4.3.0 release upgrade line.
101
    // Put any upgrade step following this.
102
 
103
    // Automatically generated Moodle v4.4.0 release upgrade line.
104
    // Put any upgrade step following this.
105
 
1441 ariadna 106
    // Automatically generated Moodle v4.5.0 release upgrade line.
107
    // Put any upgrade step following this.
108
 
109
    // Automatically generated Moodle v5.0.0 release upgrade line.
110
    // Put any upgrade step following this.
111
 
1 efrain 112
    return true;
113
}