Commit e86d2073 authored by Penny Leach's avatar Penny Leach
Browse files

postgres upgrades so that postgres is in line with the schema

parent f61a0d1a
......@@ -122,6 +122,16 @@ function xmldb_artefact_file_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2007042500) {
// migrate everything we had to change to make mysql happy
$prefix = get_config('dbprefix');
execute_sql("ALTER TABLE {$prefix}artefact_file_file_types ALTER COLUMN description TYPE varchar(32)");
execute_sql("ALTER TABLE {$prefix}artefact_file_mime_types ALTER COLUMN mimetype TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}artefact_file_mime_types ALTER COLUMN description TYPE varchar(32)");
}
// everything up to here we pre mysql support.
return $status;
}
......
......@@ -173,14 +173,19 @@ class PluginArtefactFile extends PluginArtefact {
log_info('Beginning resync of filetype list');
$currentlist = get_column('artefact_file_file_types', 'description');
foreach ($currentlist as $c) {
log_debug("c $c and trimmed is " . trim($c));
}
$newlist = xmlize(file_get_contents(get_config('docroot') . 'artefact/file/filetypes.xml'));
$filetypes = $newlist['filetypes']['#']['filetype'];
$newfiletypes = array();
//log_debug($currentlist);
// Step one: if a filetype is in the new list that is not in the current
// list, add it to the current list.
foreach ($filetypes as $filetype) {
$type = $filetype['#']['description'][0]['#'];
error_log("looking for $type");
if (!in_array($type, $currentlist)) {
log_debug('Adding filetype: ' . $type);
$currentlist[] = $type;
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007021401;
$config->version = 2007042500;
$config->release = '0.3.1';
?>
......@@ -30,6 +30,15 @@ function xmldb_artefact_internal_upgrade($oldversion=0) {
$status = true;
if ($oldversion < 2007042500) {
// migrate everything we had to change to make mysql happy
$prefix = get_config('dbprefix');
execute_sql("ALTER TABLE {$prefix}artefact_internal_profile_email ALTER COLUMN email TYPE varchar(255)");
execute_sql("ALTER TABLE {$prefix}artefact_internal_profile_icon ALTER COLUMN filename TYPE varchar(255)");
}
// everything up to here we pre mysql support.
return $status;
}
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007010800;
$config->version = 2007042500;
$config->release = '0.1';
?>
......@@ -247,6 +247,23 @@ function xmldb_core_upgrade($oldversion=0) {
upgrade_template('blogandprofile', $template);
}
if ($oldversion < 2007042500) {
// migrate everything we had to change to make mysql happy
execute_sql("ALTER TABLE {$prefix}cron DROP CONSTRAINT {$prefix}cron_cal_pk"); // can't drop primary keys using xmldb...
execute_sql("ALTER TABLE {$prefix}cron ADD CONSTRAINT {$prefix}cron_id_pk PRIMARY KEY (id)"); // or add them!
execute_sql("ALTER TABLE {$prefix}cron ADD CONSTRAINT {$prefix}cron_cal_uk UNIQUE (callfunction)");
execute_sql("ALTER TABLE {$prefix}community ALTER COLUMN name TYPE varchar (128)");
execute_sql("ALTER TABLE {$prefix}usr_activity_preference ALTER COLUMN method TYPE varchar(255)");
execute_sql("ALTER TABLE {$prefix}template_category ALTER COLUMN name TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}template_category ALTER COLUMN parent TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}template ALTER COLUMN name TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}template ALTER COLUMN category TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}view ALTER COLUMN template TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}view_access ALTER COLUMN accesstype SET DEFAULT 'public'");
}
// everything up to here we pre mysql support.
return $status;
}
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007042301;
$config->version = 2007042500;
$config->release = '0.8.0.dev';
$config->minupgradefrom = 2007011600;
$config->minupgraderelease = '0.4.0 (build tag BUILD_20070122)';
......
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