diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f3650ebd4..e0cd1dc74 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -21,6 +21,7 @@ - added: Manage System Trash group setting - fixed #11069: "More" options menu in asset manager - rfe #10755: Adding SetLanguage bazaar item + - fixed #11176: New upgrade error in 7.6.35 to 7.7.17 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/docs/upgrades/upgrade_7.8.2-7.8.3.pl b/docs/upgrades/upgrade_7.8.2-7.8.3.pl index b854cfd93..ab4476476 100644 --- a/docs/upgrades/upgrade_7.8.2-7.8.3.pl +++ b/docs/upgrades/upgrade_7.8.2-7.8.3.pl @@ -63,17 +63,20 @@ sub addTrashAdminSetting { sub reKeyTemplateAttachments { my $session = shift; print "\tChanging the key structure for the template attachments table... " unless $quiet; - # and here's our code - $session->db->write('ALTER TABLE template_attachments ADD COLUMN attachId CHAR(22) BINARY NOT NULL'); - my $rh = $session->db->read('select url, templateId, revisionDate from template_attachments'); - my $wh = $session->db->prepare('update template_attachments set attachId=? where url=? and templateId=? and revisionDate=?'); - while (my @key = $rh->array) { - $wh->execute([$session->id->generate, @key ]); + my $columnExists = $session->db->dbh->column_info(undef, undef, 'template_attachments', 'attachId')->fetchrow_hashref; + if (! $columnExists) { + # and here's our code + $session->db->write('ALTER TABLE template_attachments ADD COLUMN attachId CHAR(22) BINARY NOT NULL'); + my $rh = $session->db->read('select url, templateId, revisionDate from template_attachments'); + my $wh = $session->db->prepare('update template_attachments set attachId=? where url=? and templateId=? and revisionDate=?'); + while (my @key = $rh->array) { + $wh->execute([$session->id->generate, @key ]); + } + $rh->finish; + $wh->finish; + $session->db->write('ALTER TABLE template_attachments DROP PRIMARY KEY'); + $session->db->write('ALTER TABLE template_attachments ADD PRIMARY KEY (attachId)'); } - $rh->finish; - $wh->finish; - $session->db->write('ALTER TABLE template_attachments DROP PRIMARY KEY'); - $session->db->write('ALTER TABLE template_attachments ADD PRIMARY KEY (attachId)'); print "DONE!\n" unless $quiet; }