Bug 10636 - patronimage should have borrowernumber as PK, not cardnumber
[koha.git] / installer / data / mysql / kohastructure.sql
index c361885..024039f 100644 (file)
@@ -1665,11 +1665,11 @@ CREATE TABLE `patroncards` (
 
 DROP TABLE IF EXISTS `patronimage`;
 CREATE TABLE `patronimage` ( -- information related to patron images
-  `cardnumber` varchar(16) NOT NULL, -- the cardnumber of the patron this image is attached to (borrowers.cardnumber)
+  `borrowernumber` int(11) NOT NULL, -- the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)
   `mimetype` varchar(15) NOT NULL, -- the format of the image (png, jpg, etc)
   `imagefile` mediumblob NOT NULL, -- the image
-  PRIMARY KEY  (`cardnumber`),
-  CONSTRAINT `patronimage_fk1` FOREIGN KEY (`cardnumber`) REFERENCES `borrowers` (`cardnumber`) ON DELETE CASCADE ON UPDATE CASCADE
+  PRIMARY KEY  (`borrowernumber`),
+  CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 -- Table structure for table `pending_offline_operations`