From 27c1fe94232fb7b933b6ed3a2ff1e3388baa52ad Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 14 Oct 2009 09:08:01 -0700 Subject: [PATCH] Convert varchar fields to char in the db. Fixes bug #11126 --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.8.1-7.8.2.pl | 45 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index fe462decb..6bd40ff9c 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -16,6 +16,7 @@ - fixed #11122: Survey icon is missing from admin console - fixed #11107: linked image with caption - fixed #10914: Shop: No email notifications sent when the cart has net value 0 + - fixed #11126: WebGUI database has varchar fields 7.8.1 - mark $session->datetime->time as deprecated and remove its use from core code diff --git a/docs/upgrades/upgrade_7.8.1-7.8.2.pl b/docs/upgrades/upgrade_7.8.1-7.8.2.pl index 8fe9f57c9..348e20cee 100644 --- a/docs/upgrades/upgrade_7.8.1-7.8.2.pl +++ b/docs/upgrades/upgrade_7.8.1-7.8.2.pl @@ -34,6 +34,7 @@ my $session = start(); # this line required fixTableDefaultCharsets($session); correctWikiAttachmentPermissions( $session ); transactionsNotifications( $session ); +fixBadVarCharColumns ( $session ); finish($session); # this line required @@ -126,6 +127,50 @@ sub transactionsNotifications { print "Done.\n" unless $quiet; } +#---------------------------------------------------------------------------- +# Describe what our function does +sub fixBadVarCharColumns { + my $session = shift; + print "\tGive all revisionDate columns the correct definition... " unless $quiet; + my @dataSets = ( + [ 'AdSku', 'assetId', "CHAR(22) BINARY NOT NULL" ], + [ 'AdSku', 'purchaseTemplate', "CHAR(22) BINARY NOT NULL" ], + [ 'AdSku', 'manageTemplate', "CHAR(22) BINARY NOT NULL" ], + [ 'AdSku', 'adSpace', "CHAR(22) BINARY NOT NULL" ], + [ 'AdSku', 'clickDiscounts', "CHAR(22) DEFAULT NULL" ], + [ 'AdSku', 'impressionDiscounts', "CHAR(22) DEFAULT NULL" ], + [ 'Collaboration', 'replyRichEditor', "CHAR(22) BINARY DEFAULT 'PBrichedit000000000002'" ], + [ 'Collaboration', 'replyFilterCode', "CHAR(30) BINARY DEFAULT 'javascript'" ], + [ 'DataForm', 'htmlAreaRichEditor', "CHAR(22) BINARY DEFAULT '**Use_Default_Editor**'" ], + [ 'MapPoint', 'website', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'address1', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'address2', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'city', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'state', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'zipCode', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'country', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'phone', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'fax', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'MapPoint', 'email', "CHAR(22) BINARY DEFAULT NULL" ], + [ 'Survey', 'onSurveyEndWorkflowId',"CHAR(22) BINARY DEFAULT NULL" ], + [ 'Survey_questionTypes', 'questionType', "CHAR(56) NOT NULL" ], + [ 'bucketLog', 'userId', "CHAR(22) BINARY NOT NULL" ], + [ 'bucketLog', 'Bucket', "CHAR(22) BINARY NOT NULL" ], + [ 'deltaLog', 'userId', "CHAR(22) BINARY NOT NULL" ], + [ 'deltaLog', 'assetId', "CHAR(22) BINARY NOT NULL" ], + [ 'deltaLog', 'url', "CHAR(255) NOT NULL" ], + [ 'passiveAnalyticsStatus', 'userId', "CHAR(255) NOT NULL" ], + [ 'passiveLog', 'url', "CHAR(255) NOT NULL" ], + [ 'passiveLog', 'userId', "CHAR(22) BINARY NOT NULL" ], + [ 'passiveLog', 'assetId', "CHAR(22) BINARY NOT NULL" ], + [ 'passiveLog', 'sessionId', "CHAR(22) BINARY NOT NULL" ], + ); + foreach my $dataSet (@dataSets) { + $session->db->write(sprintf "ALTER TABLE `%s` MODIFY COLUMN `%s` %s", @{ $dataSet }); + } + print "Done.\n" unless $quiet; +} + # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- #----------------------------------------------------------------------------