put checks in before alter groupGroupings table
This commit is contained in:
parent
f852bd8866
commit
d99e4cc415
1 changed files with 10 additions and 2 deletions
|
|
@ -62,11 +62,19 @@ sub addRejectNoticeSetting {
|
||||||
sub updateGroupGroupingsTable {
|
sub updateGroupGroupingsTable {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
print "\tAdding primary key and indicies to groupGroupings table... " unless $quiet;
|
print "\tAdding primary key and indicies to groupGroupings table... " unless $quiet;
|
||||||
$session->db->write("alter table groupGroupings add primary key (groupId,inGroup)");
|
my $sth = $session->db->read('show create table groupGroupings');
|
||||||
$session->db->write("alter table groupGroupings add index inGroup (inGroup)");
|
my ($field,$stmt) = $sth->array;
|
||||||
|
$sth->finish;
|
||||||
|
unless ($stmt =~ m/PRIMARY KEY/i) {
|
||||||
|
$session->db->write("alter table groupGroupings add primary key (groupId,inGroup)");
|
||||||
|
}
|
||||||
|
unless ($stmt =~ m/KEY `inGroup`/i) {
|
||||||
|
$session->db->write("alter table groupGroupings add index inGroup (inGroup)");
|
||||||
|
}
|
||||||
print "DONE!\n" unless $quiet;
|
print "DONE!\n" unless $quiet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Describe what our function does
|
# Describe what our function does
|
||||||
sub fixRequestForApprovalScratch {
|
sub fixRequestForApprovalScratch {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue