Added a 'leftmargin' field

Also renamed the 'margin' field to 'rightmargin'
to easily distinguish between the two.
This commit is contained in:
Mark Nelson 2015-12-08 17:41:38 +08:00
parent 9413d65ee0
commit 355de679e8
10 changed files with 118 additions and 32 deletions

View file

@ -100,5 +100,34 @@ function xmldb_customcert_upgrade($oldversion=0) {
upgrade_mod_savepoint(true, 2015120800, 'customcert');
}
if ($oldversion < 2015120801) {
// Rename the 'margin' field to 'rightmargin' in the 'customcert_pages' and 'customcert_template_pages' tables.
$table = new xmldb_table('customcert_pages');
$field = new xmldb_field('margin', XMLDB_TYPE_INTEGER, 10, null, null, null, 0, 'height');
if ($dbman->field_exists($table, $field)) {
$dbman->rename_field($table, $field, 'rightmargin');
}
$table = new xmldb_table('customcert_template_pages');
if ($dbman->field_exists($table, $field)) {
$dbman->rename_field($table, $field, 'rightmargin');
}
// Add 'leftmargin' fields to the 'customcert_pages' and 'customcert_template_pages' tables.
$table = new xmldb_table('customcert_pages');
$field = new xmldb_field('leftmargin', XMLDB_TYPE_INTEGER, 10, null, null, null, 0, 'height');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$table = new xmldb_table('customcert_template_pages');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Customcert savepoint reached.
upgrade_mod_savepoint(true, 2015120801, 'customcert');
}
return true;
}