Bug 31086: (QA follow-up) Improve atomicupdate to be more resilient
We now populate the branchcode field with the first available branch on the system if we find it to be NULL before we set the NOT NULL Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commit5fa510b431) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commit13a3b0be9c) Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
parent
d780879565
commit
3683037c3b
|
|
@ -6,10 +6,18 @@ return {
|
|||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh, $out) = @$args{qw(dbh out)};
|
||||
|
||||
# Ensure we have no NULL's in the branchcode field
|
||||
$dbh->do(q{
|
||||
UPDATE reserves SET branchcode = ( SELECT branchcode FROM branches LIMIT 1) WHERE branchode IS NULL;
|
||||
});
|
||||
|
||||
# Set the NOT NULL configuration
|
||||
$dbh->do(q{
|
||||
ALTER TABLE reserves
|
||||
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'
|
||||
});
|
||||
|
||||
# Print useful stuff here
|
||||
say $out "Removed NULL option from branchcode for reserves";
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue