Bug 33671: (follow-up) Disable FK check for column change
[koha.git] / installer / data / mysql / db_revs / 220600045.pl
1 use Modern::Perl;
2
3 return {
4     bug_number  => 29144,
5     description => "Copy and remove branches.opac_info",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9
10         if ( column_exists( 'branches', 'opac_info' ) ) {
11             $dbh->do(q{
12     INSERT IGNORE INTO additional_contents ( category,code,location,branchcode,title,content,lang,published_on )
13     SELECT 'html_customizations', CONCAT('OpacLibraryInfo_', branches.branchcode), 'OpacLibraryInfo', branches.branchcode, branches.branchname, branches.opac_info, 'default', NOW()
14     FROM branches
15     WHERE branches.opac_info IS NOT NULL
16             });
17
18             $dbh->do(q{
19                 ALTER TABLE branches DROP COLUMN opac_info;
20             });
21         }
22     },
23 };