Lines 1-16
Link Here
|
1 |
$DBversion = 'XXX'; # will be replaced by the RM |
1 |
$DBversion = 'XXX'; # will be replaced by the RM |
2 |
if( CheckVersion( $DBversion ) ) { |
2 |
if( CheckVersion( $DBversion ) ) { |
3 |
# you can use $dbh here like: |
3 |
if ( !column_exists( 'reserves', 'desk_id' ) ) { |
4 |
$dbh->do(q{ |
4 |
$dbh->do(q{ |
5 |
ALTER TABLE reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode, |
5 |
ALTER TABLE reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode, |
6 |
ADD KEY desk_id (`desk_id`), |
6 |
ADD KEY desk_id (`desk_id`), |
7 |
ADD CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE CASCADE ON UPDATE CASCADE ; |
7 |
ADD CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE CASCADE ON UPDATE CASCADE ; |
8 |
}); |
8 |
}); |
9 |
$dbh->do(q{ |
9 |
$dbh->do(q{ |
10 |
ALTER TABLE old_reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode, |
10 |
ALTER TABLE old_reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode, |
11 |
ADD KEY `old_desk_id` (`desk_id`); |
11 |
ADD KEY `old_desk_id` (`desk_id`); |
12 |
}); |
12 |
}); |
13 |
|
13 |
|
14 |
SetVersion( $DBversion ); |
14 |
SetVersion( $DBversion ); |
15 |
print "Upgrade to $DBversion done (Bug XXXXX - Attach waiting reserve to desk)\n"; |
15 |
print "Upgrade to $DBversion done (Bug XXXXX - Attach waiting reserve to desk)\n"; |
|
|
16 |
} |
16 |
} |
17 |
} |