Commit f98a63cd authored by Nigel McNie's avatar Nigel McNie
Browse files

More database consistency fixes. Made sure many NOT NULL columns didn't...

More database consistency fixes. Made sure many NOT NULL columns didn't unnecessariliy have a DEFAULT '' on them. Made sure the MySQL default isn't to make them DEFAULT '' either
parent d508a190
......@@ -404,6 +404,86 @@ function xmldb_core_upgrade($oldversion=0) {
insert_record('application',$record);
}
if ($oldversion < 2008080700) {
// Drop DEFAULT '' from many columns that should not have had them
// *nigel looks angrily at xmldb
execute_sql('
ALTER TABLE notification_cron ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE notification_cron ALTER COLUMN callfunction DROP DEFAULT;
ALTER TABLE view_tag ALTER COLUMN tag DROP DEFAULT;
ALTER TABLE site_content ALTER COLUMN name DROP DEFAULT;
ALTER TABLE search_installed ALTER COLUMN name DROP DEFAULT;
ALTER TABLE usr_registration ALTER COLUMN salt DROP DEFAULT;
ALTER TABLE usr_registration ALTER COLUMN "password" DROP DEFAULT;
ALTER TABLE usr_registration ALTER COLUMN username DROP DEFAULT;
ALTER TABLE usr_registration ALTER COLUMN "key" DROP DEFAULT;
ALTER TABLE usr_registration ALTER COLUMN institution DROP DEFAULT;
ALTER TABLE auth_config ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE auth_config ALTER COLUMN field DROP DEFAULT;
ALTER TABLE artefact_cron ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE artefact_cron ALTER COLUMN callfunction DROP DEFAULT;
ALTER TABLE notification_event_subscription ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE notification_event_subscription ALTER COLUMN callfunction DROP DEFAULT;
ALTER TABLE notification_event_subscription ALTER COLUMN event DROP DEFAULT;
ALTER TABLE notification_internal_activity ALTER COLUMN "type" DROP DEFAULT;
ALTER TABLE activity_type ALTER COLUMN name DROP DEFAULT;
ALTER TABLE auth_event_subscription ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE auth_event_subscription ALTER COLUMN callfunction DROP DEFAULT;
ALTER TABLE auth_event_subscription ALTER COLUMN event DROP DEFAULT;
ALTER TABLE search_config ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE search_config ALTER COLUMN field DROP DEFAULT;
ALTER TABLE cron ALTER COLUMN callfunction DROP DEFAULT;
ALTER TABLE artefact_tag ALTER COLUMN tag DROP DEFAULT;
ALTER TABLE artefact_config ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE artefact_config ALTER COLUMN field DROP DEFAULT;
ALTER TABLE institution ALTER COLUMN name DROP DEFAULT;
ALTER TABLE institution ALTER COLUMN displayname DROP DEFAULT;
ALTER TABLE auth_instance_config ALTER COLUMN field DROP DEFAULT;
ALTER TABLE notification_installed ALTER COLUMN name DROP DEFAULT;
ALTER TABLE auth_installed ALTER COLUMN name DROP DEFAULT;
ALTER TABLE artefact ALTER COLUMN artefacttype DROP DEFAULT;
ALTER TABLE artefact_installed_type ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE artefact_installed_type ALTER COLUMN name DROP DEFAULT;
ALTER TABLE event_type ALTER COLUMN name DROP DEFAULT;
ALTER TABLE usr_account_preference ALTER COLUMN field DROP DEFAULT;
ALTER TABLE activity_queue ALTER COLUMN "type" DROP DEFAULT;
ALTER TABLE notification_config ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE notification_config ALTER COLUMN field DROP DEFAULT;
ALTER TABLE artefact_installed ALTER COLUMN name DROP DEFAULT;
ALTER TABLE notification_emaildigest_queue ALTER COLUMN "type" DROP DEFAULT;
ALTER TABLE sso_session ALTER COLUMN useragent DROP DEFAULT;
ALTER TABLE sso_session ALTER COLUMN username DROP DEFAULT;
ALTER TABLE sso_session ALTER COLUMN sessionid DROP DEFAULT;
ALTER TABLE sso_session ALTER COLUMN token DROP DEFAULT;
ALTER TABLE search_event_subscription ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE search_event_subscription ALTER COLUMN callfunction DROP DEFAULT;
ALTER TABLE search_event_subscription ALTER COLUMN event DROP DEFAULT;
ALTER TABLE usr ALTER COLUMN "password" DROP DEFAULT;
ALTER TABLE usr ALTER COLUMN username DROP DEFAULT;
ALTER TABLE application ALTER COLUMN xmlrpcserverurl DROP DEFAULT;
ALTER TABLE application ALTER COLUMN ssolandurl DROP DEFAULT;
ALTER TABLE application ALTER COLUMN name DROP DEFAULT;
ALTER TABLE application ALTER COLUMN displayname DROP DEFAULT;
ALTER TABLE institution_locked_profile_field ALTER COLUMN name DROP DEFAULT;
ALTER TABLE institution_locked_profile_field ALTER COLUMN profilefield DROP DEFAULT;
ALTER TABLE usr_password_request ALTER COLUMN "key" DROP DEFAULT;
ALTER TABLE search_cron ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE search_cron ALTER COLUMN callfunction DROP DEFAULT;
ALTER TABLE auth_instance ALTER COLUMN instancename DROP DEFAULT;
ALTER TABLE auth_instance ALTER COLUMN authname DROP DEFAULT;
ALTER TABLE auth_instance ALTER COLUMN institution DROP DEFAULT;
ALTER TABLE artefact_event_subscription ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE artefact_event_subscription ALTER COLUMN callfunction DROP DEFAULT;
ALTER TABLE artefact_event_subscription ALTER COLUMN event DROP DEFAULT;
ALTER TABLE host ALTER COLUMN wwwroot DROP DEFAULT;
ALTER TABLE host ALTER COLUMN institution DROP DEFAULT;
ALTER TABLE usr_activity_preference ALTER COLUMN activity DROP DEFAULT;
ALTER TABLE config ALTER COLUMN field DROP DEFAULT;
ALTER TABLE auth_cron ALTER COLUMN plugin DROP DEFAULT;
ALTER TABLE auth_cron ALTER COLUMN callfunction DROP DEFAULT;
');
}
return $status;
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007072800;
$config->version = 2007080700;
$config->release = '0.8.0';
$config->minupgradefrom = 2007011600;
$config->minupgraderelease = '0.4.0 (build tag BUILD_20070122)';
......
......@@ -34,7 +34,7 @@ class XMLDBmysql extends XMLDBGenerator {
var $quote_string = '`'; // String used to quote names
var $default_for_char = ''; // To define the default to set for NOT NULLs CHARs without default (null=do nothing)
var $default_for_char = null; // To define the default to set for NOT NULLs CHARs without default (null=do nothing)
var $drop_default_clause_required = true; //To specify if the generator must use some DEFAULT clause to drop defaults
var $drop_default_clause = 'NULL'; //The DEFAULT clause required to drop defaults
......
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