View | Details | Raw Unified | Return to bug 31086
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_31086_do_not_allow_null_branchcode_in_reserves.pl (-1 / +8 lines)
Lines 6-15 return { Link Here
6
    up => sub {
6
    up => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        # Ensure we have no NULL's in the branchcode field
11
        $dbh->do(q{
12
            UPDATE reserves SET branchcode = ( SELECT branchcode FROM branches LIMIT 1) WHERE branchode IS NULL;
13
        });
14
15
        # Set the NOT NULL configuration
9
        $dbh->do(q{
16
        $dbh->do(q{
10
            ALTER TABLE reserves
17
            ALTER TABLE reserves
11
            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'
18
            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'
12
        });
19
        });
20
13
        # Print useful stuff here
21
        # Print useful stuff here
14
        say $out "Removed NULL option from branchcode for reserves";
22
        say $out "Removed NULL option from branchcode for reserves";
15
    },
23
    },
16
- 

Return to bug 31086