Unknown column 'weight'

deith - November 28, 2008 - 02:18
Project:Affiliates
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:paulbooker
Status:closed
Description

Hello, i installed module today.
When I click in menu 'Affiliates Home' -> 'Affiliates' and try to add Category this shows:

* user warning: Unknown column 'weight' in 'field list' query: INSERT INTO affiliates_cats (cat_name, active, weight) VALUES ('Kategoria', 'Y', 5) in /ftp/labs/modules/affiliates/affiliates.module on line 595.
* user warning: Unknown column 'weight' in 'field list' query: SELECT cat_id, cat_name, active, weight FROM affiliates_cats ORDER BY weight DESC LIMIT 0, 50 in /ftp/labs/modules/affiliates/affiliates.module on line 693.

When i try view categories:

user warning: Unknown column 'weight' in 'field list' query: SELECT cat_id, cat_name, active, weight FROM affiliates_cats ORDER BY weight DESC LIMIT 0, 50 in /ftp/labs/modules/affiliates/affiliates.module on line 693.

The configuration options are at their default values.

#1

MadMakz - December 8, 2008 - 13:22

Same here? Is that project even still active?

#2

kbahey - December 8, 2008 - 16:19

It is active and had a major rehaul of late, and an additional maintainer.

Please be patient while he responds.

#3

paulbooker - December 19, 2008 - 14:39
Assigned to:Anonymous» paulbooker

Apologies for the late reply , looking into this now ...

#4

paulbooker - December 19, 2008 - 14:49
Status:active» closed

Thanks for the heads up , i need to update the documentation,

What you need to do is go to the "status report" page @ admin/reports/status
and find the section "Database updates" which should request you to update
the database to pick up the new field defined in the affiliates.install file ..

function affiliates_update_1() {
db_add_field($ret, affiliates_cats, 'weight', array('type' => 'int', 'length' => '3','default' => 0));
}

Please reopen if you need further assistance.

-Paul

#5

fred0 - December 28, 2008 - 01:55

Hmm... I just installed the dev version and am seeing this error right off the bat. Looking at the install file, I see that function listed at the end, but the field does not exist in my database.
Tried database update, but it didn't recognize that function as a needed update. I had to select it manually in the update list to get it to apply. It succeeded in adding the field, but I got this returned after the update:

• warning: array_merge() [function.array-merge]: Argument #2 is not an array in update.php on line 174.
• warning: Invalid argument supplied for foreach() in update.php on line 339.

#6

fred0 - December 29, 2008 - 09:22

Ok, after fixing a few things in the .module file (see here: http://drupal.org/node/100042#comment-1173863), I realized the .install file needed some work too. The attached patch fixes the update function, adds the weight to the initial install routine and inserts the weight value. It also fixes the uninstall routine.

AttachmentSize
affiliates_install.patch 2.09 KB

#7

kbahey - December 29, 2008 - 14:45

Committed.

Thanks fred0.

 
 

Drupal is a registered trademark of Dries Buytaert.