diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 70560e7ba..1776f3cd3 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -11,6 +11,7 @@ - fixed #11621: Documentation Error: Methods that accept URLs should indicate whether or not to include Gateway - fixed #11457: Carousel broken - fixed #11455: Wrong use of Extras macro? + - fixed #11715: "Empty" user profile fields: not in userProfileData / cannot delete 7.9.8 - fixed #11651: First Day of Week is a string... diff --git a/docs/upgrades/upgrade_7.9.8-7.9.9.pl b/docs/upgrades/upgrade_7.9.8-7.9.9.pl index 14b70bc79..9cef9ef30 100644 --- a/docs/upgrades/upgrade_7.9.8-7.9.9.pl +++ b/docs/upgrades/upgrade_7.9.8-7.9.9.pl @@ -22,6 +22,7 @@ use Getopt::Long; use WebGUI::Session; use WebGUI::Storage; use WebGUI::Asset; +use WebGUI::ProfileField; my $toVersion = '7.9.9'; @@ -33,6 +34,7 @@ my $session = start(); # this line required # upgrade functions go here addIndexToUserSessionLog($session); addHeightToCarousel($session); +synchronizeUserProfileTables($session); finish($session); # this line required @@ -64,6 +66,23 @@ sub addHeightToCarousel { print "DONE!\n" unless $quiet; } +#---------------------------------------------------------------------------- +# Describe what our function does +sub synchronizeUserProfileTables { + my $session = shift; + print "\tMake sure that userProfileField, and userProfileData tables are aligned correctly... " unless $quiet; + my $dbh = $session->db->dbh; + my $fields = WebGUI::ProfileField->getFields($session); + foreach my $field ( @{ $fields } ) { + my $columnInfo = $dbh->column_info(undef, undef, 'userProfileData', $field->getId)->fetchrow_hashref(); + if (! $columnInfo) { + printf "\n\t\tDeleting broken field: %s", $field->getId; + $session->db->deleteRow('userProfileField', 'fieldName', $field->getId); + } + } + + print " ...DONE!\n" unless $quiet; +} # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index 9e5cbcc9e..2e31d0cd3 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -170,7 +170,7 @@ sub create { # Add the column to the userProfileData table $db->write( - "ALTER TABLE userProfileData ADD " . $db->dbh->quote_identifier($fieldName) + "ALTER TABLE userProfileData ADD " . $db->dbh->quote_identifier($id) . $dbDataType );