--- affiliates.install.orig 2008-11-24 15:16:53.000000000 -0800 +++ affiliates.install 2008-12-29 01:02:04.000000000 -0800 @@ -7,16 +7,17 @@ function affiliates_install() { drupal_install_schema('affiliates'); - db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Email Signature', 'Y');"); - db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Buttons', 'Y');"); - db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Ad Banners', 'Y');"); + db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Email Signature', 'Y', 0);"); + db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Buttons', 'Y', 0);"); + db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Ad Banners', 'Y', 0);"); } /** * Implementation of hook_uninstall(). */ -function sfx_affiliates_uninstall() { +function affiliates_uninstall() { drupal_uninstall_schema('affiliates'); + db_query("DELETE FROM {variable} WHERE name LIKE 'affiliate\_%'"); } @@ -67,13 +68,25 @@ 'cat_id' => array('type' => 'serial', 'length' => '3','unsigned' => TRUE, 'not null' => TRUE), 'cat_name' => array('type' => 'varchar', 'length' => '30', 'default' => NULL), 'active' => array('type' => 'char', 'length' => '1','default' => NULL), + 'weight' => array('type' => 'int', 'length' => '3', 'not null' => TRUE, 'default' => 0), ), 'primary key' => array('cat_id'), - ); - + ); + $schema['affiliates_summary'] = array( + 'fields' => array( + 'user_id' => array('type' => 'int', 'length' => '10' ), + 'total_points' => array('type' => 'int', 'length' => '10' ), + 'period_points' => array('type' => 'int', 'length' => '10' ), + 'previous_period_points' => array('type' => 'int', 'length' => '10' ), + ), + 'primary key' => array('user_id'), + ); + return $schema; } function affiliates_update_1() { - db_add_field($ret, affiliates_cats, 'weight', array('type' => 'int', 'length' => '3','default' => 0)); + $ret = array(); + db_add_field($ret, 'affiliates_cats', 'weight', array('type' => 'int', 'length' => '3', 'not null' => TRUE, 'default' => 0)); + return $ret; }