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
|
||||
- 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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue