Bug 10965: fix breakage when loading sample itemtypes during install
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Sat, 28 Sep 2013 19:24:50 +0000 (16:24 -0300)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 2 Oct 2013 14:35:44 +0000 (14:35 +0000)
Bug 10513 added two columns to table itemtypes,
but sample_itemtypes can't be loaded because
it relies on old structure.

This patch rewrites sample_itemtypes.sql, stating
explicitly columns, removing backticks and consolidates
all in one insertion.

To test:
1) On master with current DB structure, delete item types

2) try loading sample_itemtyes.sql
It fails with "ERROR 1136 (21S01) at line 1: Column count doesn't match value count at row 1"

3) apply patch

4) try again, this time it will load and itemtypes created

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
SQL change only.
Tested by running the web installer on an empty database.
All sample data loads without errors.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
installer/data/mysql/en/optional/sample_itemtypes.sql

index 76510b4..9180dec 100644 (file)
@@ -1,8 +1,9 @@
-INSERT INTO `itemtypes` VALUES ('BK', 'Books',5,0,'bridge/book.gif','');
-INSERT INTO `itemtypes` VALUES ('MX', 'Mixed Materials',5,0,'bridge/kit.gif','');
-INSERT INTO `itemtypes` VALUES ('CF', 'Computer Files',5,0,'bridge/computer_file.gif','');
-INSERT INTO `itemtypes` VALUES ('MP', 'Maps',5,0,'bridge/map.gif','');
-INSERT INTO `itemtypes` VALUES ('VM', 'Visual Materials',5,1,'bridge/dvd.gif','');
-INSERT INTO `itemtypes` VALUES ('MU', 'Music',5,0,'bridge/sound.gif','');
-INSERT INTO `itemtypes` VALUES ('CR', 'Continuing Resources',5,0,'bridge/periodical.gif','');
-INSERT INTO `itemtypes` VALUES ('REF', 'Reference',0,1,'','');
+INSERT INTO itemtypes (itemtype, description, rentalcharge, notforloan, imageurl, summary) VALUES
+('BK', 'Books',5,0,'bridge/book.gif',''),
+('MX', 'Mixed Materials',5,0,'bridge/kit.gif',''),
+('CF', 'Computer Files',5,0,'bridge/computer_file.gif',''),
+('MP', 'Maps',5,0,'bridge/map.gif',''),
+('VM', 'Visual Materials',5,1,'bridge/dvd.gif',''),
+('MU', 'Music',5,0,'bridge/sound.gif',''),
+('CR', 'Continuing Resources',5,0,'bridge/periodical.gif',''),
+('REF', 'Reference',0,1,'','');