Commit 124362f4 authored by Nigel McNie's avatar Nigel McNie
Browse files

More fixes to the upgrade process so that MySQL users can upgrade.

XMLDB and MySQL conspired to make this a horrible process.
parent a88813e0
......@@ -334,8 +334,14 @@ function xmldb_core_upgrade($oldversion=0) {
// given that the table needs to be used by block instances being
// created, make the fields nullable during that time.
// Note - XMLDB - you are a whore. Hate, Nigel
execute_sql('ALTER TABLE {view_artefact} ALTER ctime DROP NOT NULL');
execute_sql('ALTER TABLE {view_artefact} ALTER format DROP NOT NULL');
if (is_postgres()) {
execute_sql('ALTER TABLE {view_artefact} ALTER ctime DROP NOT NULL');
execute_sql('ALTER TABLE {view_artefact} ALTER format DROP NOT NULL');
}
else {
execute_sql('ALTER TABLE {view_artefact} CHANGE ctime ctime DATETIME');
execute_sql('ALTER TABLE {view_artefact} CHANGE format format TEXT');
}
// Install all the blocktypes and their categories now, as they'll be
// needed for the template migration
......@@ -358,13 +364,24 @@ function xmldb_core_upgrade($oldversion=0) {
upgrade_template_migration();
delete_records_select('view_artefact', 'block IS NULL');
execute_sql('ALTER TABLE {view_artefact} ALTER block SET NOT NULL');
if (is_postgres()) {
execute_sql('ALTER TABLE {view_artefact} ALTER block SET NOT NULL');
}
else {
execute_sql('ALTER TABLE {view_artefact} CHANGE block block BIGINT(10) UNSIGNED NOT NULL');
}
$table = new XMLDBTable('view_artefact');
$field = new XMLDBField('oldblock');
drop_field($table, $field);
$table = new XMLDBTable('view');
// Especially for MySQL cos it's "advanced"
$key = new XMLDBKey('templatefk');
$key->setAttributes(XMLDB_KEY_FOREIGN, array('template'), 'template', array('name'));
drop_key($table, $key);
$field = new XMLDBField('template');
drop_field($table, $field);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment