Koha/installer/data/mysql/atomicupdate/bug_14233.perl
Martin Renvoize 00ec2839ce Bug 14233: DB changes - NoticesLog pref + letter.id PK
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:45:12 +02:00

20 lines
737 B
Perl

$DBversion = 'XXX'; # will be replaced by the RM
if ( CheckVersion($DBversion) ) {
if ( !column_exists( 'letter', 'id' ) ) {
$dbh->do(q{ALTER TABLE letter DROP PRIMARY KEY});
$dbh->do(
q{ALTER TABLE letter ADD COLUMN `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST}
);
$dbh->do(
q{ALTER TABLE letter ADD UNIQUE KEY letter_uniq_1 (`module`,`code`,`branchcode`,`message_transport_type`,`lang`)}
);
}
$dbh->do(q{
INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
VALUES ('NoticesLog','',NULL,'If enabled, log changes to notice templates','YesNo')
});
NewVersion( $DBversion, 14233, "Add id field to letter table" );
}