Conditional upgrade for template_attachments, for those coming from 7.7
This commit is contained in:
parent
6ec9fc4557
commit
7a486a983e
2 changed files with 14 additions and 10 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
- added: Manage System Trash group setting
|
- added: Manage System Trash group setting
|
||||||
- fixed #11069: "More" options menu in asset manager
|
- fixed #11069: "More" options menu in asset manager
|
||||||
- rfe #10755: Adding SetLanguage bazaar item
|
- rfe #10755: Adding SetLanguage bazaar item
|
||||||
|
- fixed #11176: New upgrade error in 7.6.35 to 7.7.17
|
||||||
|
|
||||||
7.8.2
|
7.8.2
|
||||||
- Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi)
|
- Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi)
|
||||||
|
|
|
||||||
|
|
@ -63,17 +63,20 @@ sub addTrashAdminSetting {
|
||||||
sub reKeyTemplateAttachments {
|
sub reKeyTemplateAttachments {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
print "\tChanging the key structure for the template attachments table... " unless $quiet;
|
print "\tChanging the key structure for the template attachments table... " unless $quiet;
|
||||||
# and here's our code
|
my $columnExists = $session->db->dbh->column_info(undef, undef, 'template_attachments', 'attachId')->fetchrow_hashref;
|
||||||
$session->db->write('ALTER TABLE template_attachments ADD COLUMN attachId CHAR(22) BINARY NOT NULL');
|
if (! $columnExists) {
|
||||||
my $rh = $session->db->read('select url, templateId, revisionDate from template_attachments');
|
# and here's our code
|
||||||
my $wh = $session->db->prepare('update template_attachments set attachId=? where url=? and templateId=? and revisionDate=?');
|
$session->db->write('ALTER TABLE template_attachments ADD COLUMN attachId CHAR(22) BINARY NOT NULL');
|
||||||
while (my @key = $rh->array) {
|
my $rh = $session->db->read('select url, templateId, revisionDate from template_attachments');
|
||||||
$wh->execute([$session->id->generate, @key ]);
|
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;
|
print "DONE!\n" unless $quiet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue