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

(-)a/installer/data/mysql/atomicupdate/bug_14233.perl (+15 lines)
Line 0 Link Here
1
$DBversion = 'XXX';    # will be replaced by the RM
2
if ( CheckVersion($DBversion) ) {
3
4
    if ( !column_exists( 'letter', 'id' ) ) {
5
        $dbh->do(q{ALTER TABLE letter DROP PRIMARY KEY});
6
        $dbh->do(
7
q{ALTER TABLE letter ADD COLUMN `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST}
8
        );
9
        $dbh->do(
10
q{ALTER TABLE letter ADD UNIQUE KEY letter_uniq_1 (`module`,`code`,`branchcode`,`message_transport_type`,`lang`)}
11
        );
12
    }
13
14
    NewVersion( $DBversion, 14233, "Add id field to letter table" );
15
}
(-)a/installer/data/mysql/kohastructure.sql (-2 / +3 lines)
Lines 3260-3265 DROP TABLE IF EXISTS `letter`; Link Here
3260
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3260
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3261
/*!40101 SET character_set_client = utf8 */;
3261
/*!40101 SET character_set_client = utf8 */;
3262
CREATE TABLE `letter` (
3262
CREATE TABLE `letter` (
3263
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3263
  `module` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3264
  `module` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3264
  `code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3265
  `code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3265
  `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3266
  `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
Lines 3270-3276 CREATE TABLE `letter` ( Link Here
3270
  `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3271
  `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3271
  `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3272
  `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3272
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3273
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3273
  PRIMARY KEY (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3274
  PRIMARY KEY (`id`),
3275
  UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3274
  KEY `message_transport_type_fk` (`message_transport_type`),
3276
  KEY `message_transport_type_fk` (`message_transport_type`),
3275
  CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3277
  CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3276
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3278
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3277
- 

Return to bug 14233