Upgrading from 4.6 fails, must drop tables and install manually
DanielTheViking - February 27, 2007 - 23:41
| Project: | Recipe |
| Version: | 4.7.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
On a site from the 4.6 era, the update failed, did not create new tables or alter existing ones. I ended up deleting the tables and altering and running the following from the install file manually in phpmyadmin:
CREATE TABLE recipe (
nid int(10) unsigned NOT NULL,
source varchar(255),
yield int(2) unsigned NOT NULL,
instructions text,
notes text,
preptime int(10) unsigned DEFAULT '0',
PRIMARY KEY (nid)
) /*!40100 DEFAULT CHARACTER SET utf8 */;
CREATE TABLE recipe_node_ingredient (
id int unsigned NOT NULL PRIMARY KEY auto_increment,
nid int(10) unsigned NOT NULL,
unit_id int(3) unsigned NOT NULL,
quantity double,
ingredient_id int(10) unsigned NOT NULL
) /*!40100 DEFAULT CHARACTER SET utf8 */;
CREATE TABLE recipe_ingredient (
id int(10) unsigned NOT NULL PRIMARY KEY auto_increment,
name varchar(255)
) /*!40100 DEFAULT CHARACTER SET utf8 */;
CREATE TABLE recipe_unit (
id int(3) unsigned NOT NULL PRIMARY KEY auto_increment,
name varchar(64) NOT NULL default '',
abbreviation varchar(8) NOT NULL default '',
metric int(1) unsigned NOT NULL default '0',
type enum('Mass','Volume','Unit') NOT NULL default 'Mass'
) /*!40100 DEFAULT CHARACTER SET utf8 */;
INSERT INTO recipe_unit VALUES (1, 'Slice', 'sli', 0, 'Unit');
INSERT INTO recipe_unit VALUES (2, 'Unit', '', 0, 'Unit');
INSERT INTO recipe_unit VALUES (3, 'Clove', 'clv', 0, 'Unit');
INSERT INTO recipe_unit VALUES (4, 'Pinch', 'pn', 0, 'Unit');
INSERT INTO recipe_unit VALUES (5, 'Package', 'pk', 0, 'Unit');
INSERT INTO recipe_unit VALUES (6, 'Can', 'cn', 0, 'Unit');
INSERT INTO recipe_unit VALUES (7, 'Drop', 'dr', 0, 'Unit');
INSERT INTO recipe_unit VALUES (8, 'Bunch', 'bn', 0, 'Unit');
INSERT INTO recipe_unit VALUES (9, 'Dash', 'ds', 0, 'Unit');
INSERT INTO recipe_unit VALUES (10, 'Carton', 'ct', 0, 'Unit');
INSERT INTO recipe_unit VALUES (11, 'Cup', 'c', 0, 'Unit');
INSERT INTO recipe_unit VALUES (12, 'Tablespoon', 'T', 0, 'Volume');
INSERT INTO recipe_unit VALUES (13, 'Teaspoon', 't', 0, 'Volume');
INSERT INTO recipe_unit VALUES (14, 'Pound', 'lb', 0, 'Mass');
INSERT INTO recipe_unit VALUES (15, 'Ounce', 'oz', 0, 'Mass');
INSERT INTO recipe_unit VALUES (16, 'Pint', 'pt', 0, 'Volume');
INSERT INTO recipe_unit VALUES (17, 'Quart', 'q', 0, 'Volume');
INSERT INTO recipe_unit VALUES (18, 'Gallon', 'gal', 0, 'Volume');
INSERT INTO recipe_unit VALUES (19, 'Milligram', 'mg', 1, 'Mass');
INSERT INTO recipe_unit VALUES (20, 'Centigram', 'cg', 1, 'Mass');
INSERT INTO recipe_unit VALUES (21, 'Gram', 'g', 1, 'Mass');
INSERT INTO recipe_unit VALUES (22, 'Kilogram', 'kg', 1, 'Mass');
INSERT INTO recipe_unit VALUES (23, 'Millilitre', 'ml', 1, 'Volume');
INSERT INTO recipe_unit VALUES (24, 'Centilitre', 'cl', 1, 'Volume');
INSERT INTO recipe_unit VALUES (25, 'Litre', 'l', 1, 'Volume');
INSERT INTO recipe_unit VALUES (26, 'Decilitre', 'dl', 1, 'Volume');
INSERT INTO recipe_unit VALUES (27, 'Tablespoon (Metric)', 'tbsp', 1, 'Volume');
INSERT INTO recipe_unit VALUES (28, 'Teaspoon (Metric)', 'tsp', 1, 'Volume');
INSERT INTO recipe_unit VALUES (29, 'Unknown', '', 0, 'Unit');
#1
You're the first person I've heard from who's upgraded from 4.6. Did you try to follow the procedure in the readme about importing 4.6 compatible tables? I know it's a bit awkward :(
#2
The only thing I know fails is that the normal SQL commands CREATE TABLE and ALTER TABLE simply doesnt do their job. This is what the install file is supposed to do. I simply took the install file, stripped out the PHP and ran the code manually, didn't investigate as there was not a lot of info in the old table on that site.
I cant see why this should be "awkward" for this module compared to any other module. It seems to be a matter of making a normal install file. I dont need a "solution" for this, though. Just thoght it might save some others some time to have this explanation and the SQL without PHP codes.
No need to spend time on this if no others chime in. Can leave this issue open for a while, perhaps.
#3
It's more complicated for recipe than other modules because in 4.6, ingredients, units and quantities were all stored in the same field, in a variety of different formats, so the upgrade procedure must parse these into the appropriate fields. This is necessary for the several features. You didn't say whether you read and followed the instructions for upgrading for 4.6 in the readme though, so I don't know whether the procedure failed for you, or if you didn't follow it.
#4
Ah, I just saw the file called INSTALL (no .txt extension), which I havent read until now.
I guess you are referring to this section:
I did not do any of that, just had a look at the readme, and noticed there was a recipe.install file, and overlooked the other install file.
Maybe an idea to give that file a txt extension so it is a tad more visible when given an icon.
Anyway, for me this issue does not need to be resolved. Thanks for your follow-up.
#5
closed on age - if request still active - please resubmit