Recently, I tried to use CCK in a multisite install of Drupal 5.11 and ran into a strange problem.
On one site, let's say mysite.com, CCK handled content types in content_type_xxx tables
On the other site, let's say mysite.tv, CCK handled content types in node_xxx tables
The result was a lot of error messages of that kind :
user warning: Unknown column 'field_name_value' in 'field list' query: INSERT INTO node_uprofile (field_name_value, vid, nid) VALUES ('aaaa', 40, 40) in /www-data/com/www/includes/database.mysqli.inc on line 156.
NB: My multisite install was based on the same DB (and same tables) except for those tables :
'blocks'=>
'boxes' =>
'menu' =>
'variable' =>
'cache' =>
'cache_menu'=>
which were site specific.
Actually, it is because of a variable "content_schema_version" which was set in the variable table of the .com site but not in the variable table of the .tv site (it's logical because CCK has been activated in the .com site).
I think this variable is used to handle different versions of cck.
It is used in the function "content_tablename($name, $entity, $version = NULL)" of the content module.
In this function, there is the following switch :
switch ("$version-$entity") {
case '0-'. CONTENT_DB_STORAGE_PER_CONTENT_TYPE :
return "node$name";
case '0-'. CONTENT_DB_STORAGE_PER_FIELD :
return "node_data_$name";
case '1003-'. CONTENT_DB_STORAGE_PER_CONTENT_TYPE :
return "content_type_$name";
case '1003-'. CONTENT_DB_STORAGE_PER_FIELD :
return "content_$name";
}
In the .com site, content_schema_version was set to 1003. Content types were stored in content_type_xxx
In the .tv site, content_schema_version was not set and then cck considered content types were stored in node_xxxx
A quick fix is to add the "content_schema_version" variable in the variable table of the .tv site and set it to 1003.
Or directly in MySQL : 'i:1003;'
Hope that will help other drupalers
Cheers
Geraud
