Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.x-dev
Component:
upgrade path
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Dec 2007 at 19:25 UTC
Updated:
27 Sep 2008 at 17:31 UTC
I tried doing a CCK update, and got quite a few database update errors. Parsing through them, here are what appeared to be the root causes:
I've updated the content.install file to fix these two problems. I've only modified the content_update_6000 function. Now it looks like I need to investigate the node_revisions.install file...
-Fractile81
| Comment | File | Size | Author |
|---|---|---|---|
| content.install.txt | 9.95 KB | fractile81 |
Comments
Comment #1
karens commentedThe problem with text fields might be the core bug reported at http://drupal.org/node/195169.
The update to add the extra column to the cache table actually needs another fix. That table will be unusable until this update runs, so we also need to set the schema version variable to know if it has run or not and return 'cache' instead of 'content_cache' as the table name to use for the cache in content_cache_tablename() so that table is not used until it is fixed. I am committing that update now.
Leaving this open and renaming it for the remaining issue, which still needs investigation.
Comment #2
fractile81 commentedIt looks like the issue you linked to has been resolved as far as Drupal 6 is concerned. It appears they've gone the route of a schema not defining the default for a TEXT/BLOB field, and making the code auto-populate the defaults as needed. Does this also apply to my other defaults-related bug?
I've been playing with trying to get this to work in a clean way with
content_update_6000();, and I haven't been successful. Changing the columns field to not have a default throws an error ('Data truncated', MySQL Errno #1265) because it's still not supposed to be NULL. Removing the final 'NOT NULL' requirement allowed the table to be created, and could easily be adjusted at that point. As the DB API works today, it doesn't look like a singledb_add_field();will work for that field.There's also a new problem now on updating with the
content_install_types();function. Because I'm updating without any other CCK modules installed yet, the$module_field_typesand$module_widgetsarrays aren't being created at all, throwing a ton of notices and warnings on lines 32 and 39. These could benefit from checking to see if those variables aren't empty. Thecontent_field_instance_expand();function in content_crud.inc, line 110, is also throwing a lot of notices because the$widget_typesarray isn't populated completely, and would also benefit from some form of check.Comment #3
fractile81 commentedAlright, here are the steps I've taken to try and get CCK to update for me with the HEAD build from Dec 16:
content_update_6000();to not set the columns field in the node_field table to have a DEFAULT value, and to accept NULL values.$module_field_typesand$module_widgetsvariables to be empty arrays.$widget_types[$field['widget_type']]is set.text_update_6001();to reference$db_info['table']instead of$table, as the queries on lines 107 and 110 weren't working correctly since$tablewasn't instantiated. Also added [] after the$retvariable on both lines so that they don't destroy the SQL log.I'm listing these because I can't make a patch, and because I'd rather these steps be reviewed for soundness. It's worth noting that I had to drop any custom indexes on TEXT fields I'd made in the content tables, or else it'd get a "BLOB/TEXT 'X' used in key specification without a key length" error.
It appears that update.php now lists all modules available for updates, regardless of whether they're enabled or not. In testing the update process in various ways, the CCK-field/widget module updates didn't appear to work properly without the individual module being enabled. No surprise there, just wanted to pass that information along.
Finally, I'm having problems with the text.install file right now, specifically
text_update_6001();. This runs too long for me (I have a rather large content field, both data-wise and field-wise), causing a PHP timeout. I'm not sure how to fix this, other than spreading it out across updates. On the bright side, I was able to figure out why my content fields were breaking in D6 (see node #200359 -- I'll cross-post this information). Apparently thedb_field_set_no_default();call is breaking the fields. I was able to confirm commenting this line out in nodereference.install allowed me to insert data without defining all fields.I realize this is a lot of information. Should any of this be spun-off into its own issue?
Comment #4
yched commentedI committed a fix for points 2 and 4 above.
Still pondering 1 and 3...
And, right, maybe the separate issues (text_update_6001 timeout, db_field_set_no_default(), etc, could use their own separate threads ?
Comment #5
fractile81 commentedJust wanted to mention that I did another update on the last nightly (Feb 10th, 2008) and still have this problem. Here's some update output:
This was only updating the base content.module file. I haven't tested updating the other modules yet.
Comment #6
fractile81 commentedChanging the component.
Oh, and mentioning that what I outlined above (removing the DEFAULT value and the NOT NULL = TRUE setting) is what I had to do to get this to work again.
Comment #7
karens commentedBringing this forward. Is this still applicable?
Comment #8
willwade commentedJust to say - I ran this again tonight with 6.x-2.0-rc6 and it failed with the same errors as at: http://drupal.org/node/256073
My guess is that somewhere in the upgrade path Ive missed an upgrade.. I'm guessing this is not common.
Wierdly this time I'm actually getting two sets of errors (they repeat for each of my content types):
and the one I think which is more related to the above:
Any suggestions on fixing this manually?
Comment #9
yched commentedWe still have problems when text.module updates are ran before content.module updates.
This would exactly produce the errors in #256073: text module Update #6000 failed
We'd probably need the text update to '#abort' if content updates haven't been run.
I'm not sure I see how this case (text updates running before content updates) would cause the 'active' and 'widget_module' columns to be missing from {node_field_instance}...
willwade : meanwhile, the manual fix requires you look at those columns definitions in content.install's content_schema(), and create them manually in phpMyadmin or equivalent.
Comment #10
yched commented"We'd probably need the text update to '#abort' if content updates haven't been run."
We need to do that before a release.
Comment #11
yched commentedIt's actually not just text updates. noderef, for instance, has updates calling content_clear_type_cache(), which breaks badly if content updates haven't run yet.
I added a check in all helper modules updates (including the ones that do not striclty need it, just for consistency)
Comment #12
yched commentedSide note : what's the best way to publicly advise all contrib field modules to do the same ?
Comment #13
karens commentedThis might be important enough to post to the developers list. You can refer them to the way you handled it in one of the core files as an example of what they need to do.
Comment #14
yched commentedRight - I opened a separate (fixed) 'task', and advertised it on dev ML and g.d.o/cck : #304813: CCK module developers read this!!
Comment #15
cpelham commentedI also just upgraded from Drupal 5.7 to 6.4 and then from CCK 5.x-1.9 to 6 rc6 and got the errors such as:
Failed: UPDATE {node_field_instance} SET widget_module = 'text', widget_type = 'text_textfield' WHERE field_name = 'field_url' AND type_name = 'content_ot_courses'
and
user warning: Unknown column 'nf.active' in 'where clause' query: SELECT * FROM node_field_instance nfi JOIN node_field nf ON nfi.field_name = nf.field_name WHERE nf.active = 1 AND nfi.widget_active = 1 AND nfi.type_name = 'blog' ORDER BY nfi.weight ASC, nfi.label ASC in /home/willwade/public_html/otmatters/sites/all/modules/cck/includes/content.crud.inc on line 436.
I have read through this thread but do not recognize what I am supposed to do to resolve this. Cann anyone state the solution more clearly for me? Do I need to roll my system back and go through the upgrade again but this time with the lastest CCK 6 dev version instead?
Comment #16
yched commented"Do I need to roll my system back and go through the upgrade again but this time with the lastest CCK 6 dev version instead?"
Unfortunately, yes, it's the safest thing to do :-(
[edit : if by any chance you made an intermediate backup of the db after the core D6 upgrade but before the CCK upgrade, you can start from there, though.
If you didn't - well, do it next time, it's always a good idea ;-) ]
Comment #17
schildi commentedIn my case (upgrading form D5.10 0> D6.4) module "text" is not installed/activated prior to cck (but views is installed).
And I get the same message as mentioned above when trying to install cck (cck-6.x-2.x-dev.tar.gz from 12. September):
and
What can be done else to solve the problem?
Comment #18
yched commentedOK - this thread has seen several evolutions and it is starting to get confused. i suggest we deal with this in a "fresh" issue :
http://drupal.org/node/307908
schildi : can you also provide the additional informations I ask over in my comment over there ?
Comment #19
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.