Bug 30565: DBIx schema change for stockrotationrotas
[koha-ffzg.git] / installer / data / mysql / atomicupdate / bug_30565.pl
1 use Modern::Perl;
2
3 return {
4     bug_number => 30565,
5     description => "Update table stockrotationrotas",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9         if( !unique_key_exists('stockrotationrotas', 'stockrotationrotas_title') ) {
10             $dbh->do( q|
11 ALTER TABLE stockrotationrotas ADD CONSTRAINT UNIQUE KEY stockrotationrotas_title (title)
12             |);
13         }
14         # Make sure that description is NOT NULL
15         $dbh->do( q|
16 ALTER TABLE stockrotationrotas MODIFY COLUMN description text NOT NULL COMMENT 'Description for this rota'
17         |);
18     },
19 };