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 3257-3262 DROP TABLE IF EXISTS `letter`; Link Here
3257
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3257
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3258
/*!40101 SET character_set_client = utf8 */;
3258
/*!40101 SET character_set_client = utf8 */;
3259
CREATE TABLE `letter` (
3259
CREATE TABLE `letter` (
3260
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3260
  `module` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3261
  `module` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3261
  `code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3262
  `code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3262
  `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3263
  `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
Lines 3267-3273 CREATE TABLE `letter` ( Link Here
3267
  `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3268
  `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3268
  `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3269
  `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3269
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3270
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3270
  PRIMARY KEY (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3271
  PRIMARY KEY (`id`),
3272
  UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3271
  KEY `message_transport_type_fk` (`message_transport_type`),
3273
  KEY `message_transport_type_fk` (`message_transport_type`),
3272
  CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3274
  CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3273
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3275
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3274
- 

Return to bug 14233