Bug 28534: Atomic update to fix existing installs
[koha.git] / installer / data / mysql / atomicupdate / bug28534.perl
1 $DBversion = 'XXX';
2 if( CheckVersion( $DBversion ) ) {
3     if( !TableExists( 'pending_offline_operations' ) ) {
4         $dbh->do(q{
5             CREATE TABLE `pending_offline_operations` (
6             `operationid` int(11) NOT NULL AUTO_INCREMENT,
7             `userid` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
8             `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
9             `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
10             `action` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
11             `barcode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
12             `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
13             `amount` decimal(28,6) DEFAULT NULL,
14             PRIMARY KEY (`operationid`)
15             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
16         });
17     } else {
18         $dbh->do(q{
19             ALTER TABLE pending_offline_operations ENGINE = 'InnoDB';
20         });
21     }
22     NewVersion( $DBversion, 28534, "Set pending_offline_operations INNoDB rather than MyISAM");
23 }