Database field too short to handle votes from CCK nodes, varchar(20) is not sufficient enough to deal with CCK node names, my patch my resolve a lot of issues with people complaining about random behaviour of votes not working so well..

--- votingapi.install   2006-06-09 21:38:00.000000000 -0700
+++ votingapi.install-fix       2007-04-19 01:14:10.000000000 -0700
@@ -254,4 +254,10 @@ function votingapi_update_9() {
   $ret[] = update_sql("ALTER TABLE {votingapi_cache} ADD COLUMN timestamp int(11) default NULL;");
   $ret[] = update_sql("UPDATE {votingapi_cache} SET timestamp = " . time() . " WHERE timestamp IS NULL;");
   return $ret;
-}
\ No newline at end of file
+}
+
+function votingapi_update_10() {
+ $ret = array();
+ $ret[] = update_sql("ALTER TABLE {votingapi_vote} CHANGE `content_type` `content_type` VARCHAR( 50 )");
+ return $ret;
+}

you'll need to run update.php

CommentFileSizeAuthor
votingapi-install.patch609 bytesdgtlmoon

Comments

dgtlmoon’s picture

There are additional fields that need extending



function votingapi_update_10() {
 $ret = array();
 $ret[] = update_sql("ALTER TABLE {votingapi_vote} CHANGE `content_type` `content_type` VARCHAR( 50 )");
 return $ret;
}

function votingapi_update_11() {
 $ret = array();
 $ret[] = update_sql("ALTER TABLE {votingapi_cache} CHANGE `content_type` `content_type` VARCHAR( 50 )");
 $ret[] = update_sql("ALTER TABLE {votingapi_action_set} CHANGE `content_type` `content_type` VARCHAR( 50 )");

 return $ret;
}
eaton’s picture

Status: Reviewed & tested by the community » Closed (works as designed)

The 'content_type' field, while perhaps confusingly named, should store the Drupal object type being voted on. 'node', 'user', etc. Not the node type itself.

dgtlmoon’s picture

Status: Closed (works as designed) » Postponed (maintainer needs more info)

heya eaton

CCK types can be fairly long strings, so i think this issue is still open, node types defined by CCK can be greater than 20chars

eaton’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

You misunderstand: that field should store the word "node", NOT the type of the node. VotingAPI's 'content_type' field is used to store the kind of high-level content object being voted on. The length of the node type's name doesn't matter, because that should never be stored in the VotingAPI field.