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

(-)a/installer/data/mysql/atomicupdate/bug_29605.pl (-2 / +14 lines)
Lines 2-11 use Modern::Perl; Link Here
2
2
3
return {
3
return {
4
    bug_number  => "29605",
4
    bug_number  => "29605",
5
    description => "Add language_script_mapping primary key",
5
    description => "Resync DB structure for existing installations",
6
    up => sub {
6
    up => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ($dbh) = @$args{qw(dbh)};
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
9
10
        if (   !primary_key_exists( 'language_script_mapping', 'language_subtag' )
10
        if (   !primary_key_exists( 'language_script_mapping', 'language_subtag' )
11
            and index_exists( 'language_script_mapping', 'language_subtag' ) ) {
11
            and index_exists( 'language_script_mapping', 'language_subtag' ) ) {
Lines 22-27 return { Link Here
22
                ALTER TABLE language_script_mapping
22
                ALTER TABLE language_script_mapping
23
                    ADD PRIMARY KEY `language_subtag` (`language_subtag`);
23
                    ADD PRIMARY KEY `language_subtag` (`language_subtag`);
24
            });
24
            });
25
26
            say $out "Added missing primary key on language_script_mapping"
25
        }
27
        }
28
29
        unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_3') ) {
30
            $dbh->do(q{
31
                ALTER TABLE tmp_holdsqueue
32
                ADD CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
33
            });
34
35
            say $out "Added missing foreign key on tmp_holdsqueue"
36
        }
37
26
    },
38
    },
27
}
39
}
(-)a/installer/data/mysql/db_revs/210600022.pl (-2 / +1 lines)
Lines 12-18 return { Link Here
12
                ADD CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
12
                ADD CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
13
            });
13
            });
14
        }
14
        }
15
        unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_2') ) {
15
        unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_3') ) {
16
            $dbh->do(q{
16
            $dbh->do(q{
17
                ALTER TABLE tmp_holdsqueue
17
                ALTER TABLE tmp_holdsqueue
18
                ADD CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
18
                ADD CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
19
- 

Return to bug 29605