|
Lines 31-41
return {
Link Here
|
| 31 |
UPDATE reserves SET branchcode = ( SELECT branchcode FROM branches LIMIT 1) WHERE branchcode IS NULL; |
31 |
UPDATE reserves SET branchcode = ( SELECT branchcode FROM branches LIMIT 1) WHERE branchcode IS NULL; |
| 32 |
}); |
32 |
}); |
| 33 |
|
33 |
|
|
|
34 |
# Remove FOREIGN KEY CONSTRAINT |
| 35 |
$dbh->do(q{ |
| 36 |
ALTER TABLE reserves DROP FOREIGN KEY reserves_ibfk_4; |
| 37 |
}); |
| 34 |
# Set the NOT NULL configuration |
38 |
# Set the NOT NULL configuration |
| 35 |
$dbh->do(q{ |
39 |
$dbh->do(q{ |
| 36 |
ALTER TABLE reserves |
40 |
ALTER TABLE reserves |
| 37 |
MODIFY COLUMN `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at' |
41 |
MODIFY COLUMN `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at' |
| 38 |
}); |
42 |
}); |
|
|
43 |
# Replace the constraint |
| 44 |
$dbh->do(q{ |
| 45 |
ALTER TABLE reserves ADD CONSTRAINT reserves_ibfk_4 FOREIGN KEY (branchcode) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE; |
| 46 |
}); |
| 39 |
|
47 |
|
| 40 |
# Print useful stuff here |
48 |
# Print useful stuff here |
| 41 |
say $out "Removed NULL option from branchcode for reserves"; |
49 |
say $out "Removed NULL option from branchcode for reserves"; |
| 42 |
- |
|
|