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

(-)a/installer/data/mysql/atomicupdate/bug_xxxxx.perl (+20 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    if( !column_exists( 'biblioimages', 'itemnumber' ) ) {
5
        $dbh->do(q|
6
            ALTER TABLE biblioimages
7
            ADD COLUMN itemnumber INT(11) DEFAULT NULL
8
            AFTER biblionumber;
9
        |);
10
        $dbh->do(q|
11
            ALTER TABLE biblioimages
12
            ADD FOREIGN KEY bibliocoverimage_fk2 (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
13
        |);
14
        $dbh->do(q|
15
            ALTER TABLE biblioimages MODIFY biblionumber INT(11) DEFAULT NULL
16
        |)
17
    }
18
19
    NewVersion( $DBversion, 'XXXXX', "Add the biblioimages.itemnumber column");
20
}
(-)a/installer/data/mysql/kohastructure.sql (-3 / +4 lines)
Lines 3374-3386 DROP TABLE IF EXISTS `biblioimages`; Link Here
3374
3374
3375
CREATE TABLE `biblioimages` ( -- local cover images
3375
CREATE TABLE `biblioimages` ( -- local cover images
3376
 `imagenumber` int(11) NOT NULL AUTO_INCREMENT, -- unique identifier for the image
3376
 `imagenumber` int(11) NOT NULL AUTO_INCREMENT, -- unique identifier for the image
3377
 `biblionumber` int(11) NOT NULL, -- foreign key from biblio table to link to biblionumber
3377
 `biblionumber` int(11) DEFAULT NULL, -- foreign key from biblio table to link to biblionumber
3378
 `itemnumber` int(11) DEFAULT NULL, -- foreign key from item table to link to itemnumber
3378
 `mimetype` varchar(15) NOT NULL, -- image type
3379
 `mimetype` varchar(15) NOT NULL, -- image type
3379
 `imagefile` mediumblob NOT NULL, -- image file contents
3380
 `imagefile` mediumblob NOT NULL, -- image file contents
3380
 `thumbnail` mediumblob NOT NULL, -- thumbnail file contents
3381
 `thumbnail` mediumblob NOT NULL, -- thumbnail file contents
3381
 `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- image creation/update time
3382
 `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- image creation/update time
3382
 PRIMARY KEY (`imagenumber`),
3383
 PRIMARY KEY (`imagenumber`),
3383
 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3384
 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3385
 CONSTRAINT `bibliocoverimage_fk2` FOREIGN KEY (`itemnumber`) REFERENCES `item` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3384
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3386
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3385
3387
3386
--
3388
--
3387
- 

Return to bug 26145