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

(-)a/installer/data/mysql/atomicupdate/bug_41996.pl (+32 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "41996",
6
    description => "Add invoicenumber column to edifact_errors for per-invoice error filtering",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        if ( !column_exists( 'edifact_errors', 'invoicenumber' ) ) {
12
            $dbh->do(
13
                q{
14
                ALTER TABLE edifact_errors
15
                ADD COLUMN invoicenumber varchar(48) DEFAULT NULL
16
                AFTER message_id
17
            }
18
            );
19
            say_success( $out, "Added invoicenumber column to edifact_errors" );
20
21
            $dbh->do(
22
                q{
23
                ALTER TABLE edifact_errors
24
                ADD INDEX message_id_invoicenumber (message_id, invoicenumber)
25
            }
26
            );
27
            say_success( $out, "Added index message_id_invoicenumber to edifact_errors" );
28
        } else {
29
            say_info( $out, "Column invoicenumber already exists in edifact_errors" );
30
        }
31
    },
32
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2915-2925 DROP TABLE IF EXISTS `edifact_errors`; Link Here
2915
CREATE TABLE `edifact_errors` (
2915
CREATE TABLE `edifact_errors` (
2916
  `id` int(11) NOT NULL AUTO_INCREMENT,
2916
  `id` int(11) NOT NULL AUTO_INCREMENT,
2917
  `message_id` int(11) NOT NULL,
2917
  `message_id` int(11) NOT NULL,
2918
  `invoicenumber` varchar(48) DEFAULT NULL,
2918
  `date` date DEFAULT NULL,
2919
  `date` date DEFAULT NULL,
2919
  `section` mediumtext DEFAULT NULL,
2920
  `section` mediumtext DEFAULT NULL,
2920
  `details` mediumtext DEFAULT NULL,
2921
  `details` mediumtext DEFAULT NULL,
2921
  PRIMARY KEY (`id`),
2922
  PRIMARY KEY (`id`),
2922
  KEY `messageid` (`message_id`),
2923
  KEY `messageid` (`message_id`),
2924
  KEY `message_id_invoicenumber` (`message_id`, `invoicenumber`),
2923
  CONSTRAINT `emfk_message` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2925
  CONSTRAINT `emfk_message` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2924
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2926
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2925
/*!40101 SET character_set_client = @saved_cs_client */;
2927
/*!40101 SET character_set_client = @saved_cs_client */;
2926
- 

Return to bug 41996