Index: subscriptions.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/subscriptions/subscriptions.install,v retrieving revision 1.3.2.1 diff -u -r1.3.2.1 subscriptions.install --- subscriptions.install 1 Mar 2007 16:33:23 -0000 1.3.2.1 +++ subscriptions.install 16 Aug 2007 18:44:17 -0000 @@ -14,7 +14,13 @@ db_query("CREATE TABLE {subscriptions} ( sid int(10) unsigned NOT NULL, uid int(10) unsigned NOT NULL, - stype varchar(25) NOT NULL + stype varchar(25) NOT NULL, + send_interval int(10) unsigned NOT NULL default '0' + ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"); + db_query("CREATE TABLE {subscriptions_sent} ( + uid int(10) unsigned NOT NULL, + sent int(10) unsigned NOT NULL default '0', + PRIMARY KEY (uid) ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"); drupal_set_message(t('Subscriptions database tables have been installed.')); break; @@ -29,10 +35,59 @@ db_query("CREATE TABLE {subscriptions} ( sid integer NOT NULL, uid integer NOT NULL, - stype text NOT NULL + stype text NOT NULL, + send_interval integer NOT NULL + )"); + db_query("CREATE TABLE {subscriptions_sent} ( + uid integer NOT NULL, + sent integer NOT NULL default '0', + PRIMARY KEY (uid) )"); drupal_set_message(t('Subscriptions database tables have been installed.')); break; } } + +function subscriptions_uninstall() { + if (db_table_exists('subscriptions')) { + db_query("DROP TABLE {subscriptions}"); + } + if (db_table_exists('subscriptions_holding')) { + db_query("DROP TABLE {subscriptions_holding}"); + } + if (db_table_exists('subscriptions_sent')) { + db_query("DROP TABLE {subscriptions_sent}"); + } + drupal_set_message(t('Subscriptions database tables have been removed.')); +} + + +/* + * update module for version 5.x-2.x. + */ +function subscriptions_update_1() { + $ret = array(); + + switch($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $ret[] = update_sql("CREATE TABLE {subscriptions_sent} ( + uid int(10) unsigned NOT NULL, + sent int(10) unsigned NOT NULL default '0', + PRIMARY KEY (uid) + ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"); + $ret[] = update_sql("ALTER TABLE {subscriptions} ADD send_interval int(10) unsigned default '0' NOT NULL"); + break; + case 'pgsql': + $ret[] = update_sql("CREATE TABLE {subscriptions_sent} ( + uid integer NOT NULL, + sent integer NOT NULL default '0', + PRIMARY KEY (uid) + )"); + db_add_column($ret, 'subscriptions', 'send_interval', 'integer', array('default' => 0, 'not null' => TRUE)); + break; + } + return $ret; +} + ?>