Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
caseine
moodle-mod_vpl
Commits
aa797e33
Commit
aa797e33
authored
Jun 21, 2021
by
Astor Bizard
Browse files
Refactored upgrade.php (while it still has no impact).
parent
58f6e37b
Changes
1
Hide whitespace changes
Inline
Side-by-side
db/upgrade.php
View file @
aa797e33
...
...
@@ -323,7 +323,7 @@ function xmldb_vpl_upgrade($oldversion = 0) {
// VPL savepoint reached.
upgrade_mod_savepoint
(
true
,
2018011314
,
'vpl'
);
}
if
(
$oldversion
<
20210
52
600
)
{
if
(
$oldversion
<
20210
61
600
)
{
// Define table vpl_overrides to be created.
$table
=
new
xmldb_table
(
'vpl_overrides'
);
...
...
@@ -331,8 +331,6 @@ function xmldb_vpl_upgrade($oldversion = 0) {
// Adding fields to table vpl_overrides.
$table
->
add_field
(
'id'
,
XMLDB_TYPE_INTEGER
,
'10'
,
null
,
XMLDB_NOTNULL
,
XMLDB_SEQUENCE
,
null
);
$table
->
add_field
(
'vpl'
,
XMLDB_TYPE_INTEGER
,
'10'
,
null
,
null
,
null
,
null
);
$table
->
add_field
(
'userids'
,
XMLDB_TYPE_TEXT
,
null
,
null
,
null
,
null
,
null
);
$table
->
add_field
(
'groupids'
,
XMLDB_TYPE_TEXT
,
null
,
null
,
null
,
null
,
null
);
$table
->
add_field
(
'startdate'
,
XMLDB_TYPE_INTEGER
,
'10'
,
null
,
null
,
null
,
null
);
$table
->
add_field
(
'duedate'
,
XMLDB_TYPE_INTEGER
,
'10'
,
null
,
null
,
null
,
null
);
$table
->
add_field
(
'freeevaluations'
,
XMLDB_TYPE_INTEGER
,
'10'
,
null
,
null
,
null
,
null
);
...
...
@@ -341,30 +339,14 @@ function xmldb_vpl_upgrade($oldversion = 0) {
// Adding keys to table vpl_overrides.
$table
->
add_key
(
'primary'
,
XMLDB_KEY_PRIMARY
,
[
'id'
]);
// Adding indexes to table vpl_assigned_overrides.
$table
->
add_index
(
'vpl'
,
XMLDB_INDEX_NOTUNIQUE
,
[
'vpl'
]);
// Conditionally launch create table for vpl_overrides.
if
(
!
$dbman
->
table_exists
(
$table
))
{
$dbman
->
create_table
(
$table
);
}
// Vpl savepoint reached.
upgrade_mod_savepoint
(
true
,
2021052600
,
'vpl'
);
}
if
(
$oldversion
<
2021061400
)
{
// Define index vpl (not unique) to be added to vpl_overrides.
$table
=
new
xmldb_table
(
'vpl_overrides'
);
$index
=
new
xmldb_index
(
'vpl'
,
XMLDB_INDEX_NOTUNIQUE
,
[
'vpl'
]);
// Conditionally launch add index vpl.
if
(
!
$dbman
->
index_exists
(
$table
,
$index
))
{
$dbman
->
add_index
(
$table
,
$index
);
}
// Vpl savepoint reached.
upgrade_mod_savepoint
(
true
,
2021061400
,
'vpl'
);
}
if
(
$oldversion
<
2021061600
)
{
// Define table vpl_assigned_overrides to be created.
$table
=
new
xmldb_table
(
'vpl_assigned_overrides'
);
...
...
@@ -387,23 +369,6 @@ function xmldb_vpl_upgrade($oldversion = 0) {
$dbman
->
create_table
(
$table
);
}
// Define field userids to be dropped from vpl_overrides.
$table
=
new
xmldb_table
(
'vpl_overrides'
);
$field
=
new
xmldb_field
(
'userids'
);
// Conditionally launch drop field userids.
if
(
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
drop_field
(
$table
,
$field
);
}
// Define field groupids to be dropped from vpl_overrides.
$field
=
new
xmldb_field
(
'groupids'
);
// Conditionally launch drop field groupids.
if
(
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
drop_field
(
$table
,
$field
);
}
// Vpl savepoint reached.
upgrade_mod_savepoint
(
true
,
2021061600
,
'vpl'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment