Hi,

Just got this error with the latest dev version upon installation on Drupal 6.14.

user warning: Key column 'weight' doesn't exist in table query: CREATE TABLE user_badges_user ( `uid` INT unsigned NOT NULL, `bid` INT unsigned NOT NULL, `type` VARCHAR(20) NOT NULL DEFAULT '', `userweight` INT DEFAULT NULL, PRIMARY KEY (bid, uid, type), INDEX uid_bid (uid, bid), INDEX uid_weight (uid, weight), INDEX type (type) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in C:\wamp\www\www.mysite.com.au\includes\database.inc on line 529.
user warning: Table 'meganet_earth.user_badges_user' doesn't exist query: SELECT DISTINCT b.bid, b.weight, b.name, b.image, b.href, b.unhideable, b.fixedweight, b.doesnotcounttolimit, u.userweight, b.tid, CASE WHEN b.fixedweight = 1 THEN b.weight ELSE COALESCE(u.userweight,b.weight) END coalescedweight FROM user_badges_badges b INNER JOIN user_badges_user u ON b.bid = u.bid WHERE u.uid = 1 ORDER BY coalescedweight, b.name in C:\wamp\www\www.mysite.com.au\sites\all\modules\user_badges\user_badges.module on line 768.
user warning: Table 'meganet_earth.user_badges_user' doesn't exist query: SELECT DISTINCT b.bid, b.weight, b.name, b.image, b.href, b.unhideable, b.fixedweight, b.doesnotcounttolimit, u.userweight, b.tid, CASE WHEN b.fixedweight = 1 THEN b.weight ELSE COALESCE(u.userweight,b.weight) END coalescedweight FROM user_badges_badges b INNER JOIN user_badges_user u ON b.bid = u.bid WHERE u.uid = 1 ORDER BY coalescedweight, b.name in C:\wamp\www\www.mysite.com.au\sites\all\modules\user_badges\user_badges.module on line 768.

The user badge options appear in the menu, but I haven't tried to mess with any configurations yet. Uninstalling temporarily.

Comments

Nigeria’s picture

got the same with 6.14 on clean install

gateway69’s picture

anyone got this fixed, im also getting sql error, its like during the install or activation its not putting in the required db fields in the db, do you guys use localhost db or another database server, for me im using my own dedicated db..

pmflav’s picture

install non dev version first.
Then upload dev version. Then run update.php.

magnus’s picture

I converted to private file system a while ago and haven't been using this module since then. Gave it a new try when URL images where supported. I installed the 6.x-1.5 and then updated to dev and got these errors:

Update #6102

* Failed: ALTER TABLE {user_badges_badges} RENAME image TO image_old
* Failed: ALTER TABLE {user_badges_badges} ADD image varchar(255)
* Failed: UPDATE {user_badges_badges} SET image = image_old
* ALTER TABLE {user_badges_badges} ALTER image SET default ''
* Failed: ALTER TABLE {user_badges_badges} DROP image_old
* ALTER TABLE {user_badges_badges} ADD `unhideable` TINYINT NOT NULL DEFAULT 0
* ALTER TABLE {user_badges_badges} ADD `fixedweight` TINYINT NOT NULL DEFAULT 0
* ALTER TABLE {user_badges_badges} ADD `doesnotcounttolimit` TINYINT NOT NULL DEFAULT 0
* ALTER TABLE {user_badges_user} ADD `userweight` INT DEFAULT NULL
* ALTER TABLE {user_badges_user} ADD INDEX uid_weight (uid, userweight)

Update #6103

* ALTER TABLE {user_badges_badges} ADD `tid` INT unsigned DEFAULT NULL
* ALTER TABLE {user_badges_badges} ADD INDEX tid_name (tid, name)

I manually changed 'image' column to varchar(255) and set it to default ''.

If I visit the tab Badges for a user the page gets WSOD. If I have assigned a badge to the user either manually in the database or by Views Bulk Operation, then I can visit the badge tab for a user.

Akela’s picture

I am getting a similar sql error on install:

user warning: Table 'dr_latind1.latin_user_badges_user' doesn't exist query: SELECT DISTINCT b.bid, b.weight, b.name, b.image, b.href, b.unhideable, b.fixedweight, b.doesnotcounttolimit, u.userweight, b.tid, CASE WHEN b.fixedweight = 1 THEN b.weight ELSE COALESCE(u.userweight,b.weight) END coalescedweight FROM latin_user_badges_badges b INNER JOIN latin_user_badges_user u ON b.bid = u.bid WHERE u.uid = 1 ORDER BY coalescedweight, b.name in z_drupal\sites\all\modules\_users\user_badges-6.x-1.x-dev\user_badges\user_badges.module on line 768.

1kenthomas’s picture

WRT #5, see #3. Turn off, uninstall -dev, install 1.5 etc.

//subscribing.

1kenthomas’s picture

Title: SQL error on install » -dev does not properly create/manipulate tabels

Changing title.

Even with a clean 1.5 to -dev install, I get problems, such as the below. These changes need to be manually made if you have existing tables / data in tables.



    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TO image_old' at line 1 query: ALTER TABLE user_badges_badges RENAME image TO image_old in /var/www/drupal6WHM/update.php on line 125.
    * user warning: Duplicate column name 'image' query: ALTER TABLE user_badges_badges ADD image varchar(255) in /var/www/drupal6WHM/update.php on line 126.
    * user warning: Unknown column 'image_old' in 'field list' query: UPDATE user_badges_badges SET image = image_old in /var/www/drupal6WHM/update.php on line 127.
    * user warning: Can't DROP 'image_old'; check that column/key exists query: ALTER TABLE user_badges_badges DROP image_old in /var/www/drupal6WHM/update.php on line 130.

1kenthomas’s picture

Title: -dev does not properly create/manipulate tabels » -dev does not properly create/manipulate tables

The above transformation better performed via:

ALTER TABLE `example_db`.`user_badges_badges` MODIFY COLUMN `image` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

or thereabouts depending on your collation and charset choices.

Akela’s picture

Oops, how silly of me. Thank you :)

ppcc’s picture

//subscribing

nancydru’s picture

Assigned: Unassigned » nancydru

I have rewritten 6102 to use db_change_field (more D6'ish). That should fix that issue.

I am now working out why user_badges_user isn't getting built.

QUESTION: is anyone having problems with the image or description URL length? URLs are allowed to be much longer than 255.

nancydru’s picture

There was a typo in the indexes.

Committed to 6.x-1.x-dev.

nancydru’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

fizk’s picture

user_badges_update_6102 produces this error:

WD php: User warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'v(v, v) unsigned NOT NULL auto_increment DEFAULT ', ADD' at line 1    [error]
query: ALTER TABLE user_badges_badges CHANGE `image` `image` v(v, v) unsigned NOT NULL auto_increment DEFAULT ', ADD  in _db_query() (line 141 of
/var/drupal/includes/database.mysql.inc).
ALTER TABLE {user_badges_badges} CHANGE `image` `image` v(v, v) unsigned NOT NULL auto_increment DEFAULT ', ADD                                                                                                               [error]
fizk’s picture

Status: Closed (fixed) » Needs work
jk’s picture

In version 1.6 under user_badges_update_6102 line

db_change_field($ret, 'user_badges_badges', 'image', 'image', 'varchar(255)', array('not null' => FALSE, 'default' => "''"));

should be

db_change_field($ret, 'user_badges_badges', 'image', 'image', array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'default' => ''));
nancydru’s picture

Here's what I see

function user_badges_update_6102() {
  $ret = array();

  db_change_field($ret, 'user_badges_badges', 'image', 'image', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => FALSE,
    'default' => "''",
    ));
nancydru’s picture

And, BTW, this is different from the original issue, so should be in a separate issue.

shabana.navas’s picture

Status: Needs work » Closed (fixed)

Fixed in Version 7. Please upgrade to Version 7.x-3.x.

fizk’s picture

Assigned: nancydru » Unassigned
Status: Closed (fixed) » Patch (to be ported)

Thanks Shabana. It'd be great to also fix in 6.x.

shabana.navas’s picture

Will commit the change shortly.

shabana.navas’s picture

Status: Patch (to be ported) » Closed (fixed)

Committed to 6.x-1.x-dev version.