summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--database/database.mysql4
-rw-r--r--database/database.pgsql8
-rw-r--r--database/updates.inc29
-rw-r--r--modules/poll.module2
-rw-r--r--modules/poll/poll.module2
5 files changed, 20 insertions, 25 deletions
diff --git a/database/database.mysql b/database/database.mysql
index 92df2c686..f08db4f6f 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -546,8 +546,8 @@ CREATE TABLE poll (
CREATE TABLE poll_votes (
nid int(10) unsigned NOT NULL,
- uid int(10) unsigned NOT NULL,
- hostname varchar(128) NOT NULL,
+ uid int(10) unsigned NOT NULL default 0,
+ hostname varchar(128) NOT NULL default '',
INDEX (nid),
INDEX (uid),
INDEX (hostname)
diff --git a/database/database.pgsql b/database/database.pgsql
index 7883dd06c..782ca52ce 100644
--- a/database/database.pgsql
+++ b/database/database.pgsql
@@ -540,11 +540,11 @@ CREATE TABLE poll (
--
CREATE TABLE poll_votes (
- nid int(10) NOT NULL,
- uid int(10) NOT NULL,
- hostname varchar(128) NOT NULL
+ nid int NOT NULL,
+ uid int NOT NULL default 0,
+ hostname varchar(128) NOT NULL default ''
);
-CREATE INDEX poll_voter_nid_idx ON poll_votes (nid);
+CREATE INDEX poll_votes_nid_idx ON poll_votes (nid);
CREATE INDEX poll_votes_uid_idx ON poll_votes (uid);
CREATE INDEX poll_votes_hostname_idx ON poll_votes (hostname);
diff --git a/database/updates.inc b/database/updates.inc
index 26f627342..22412f5d6 100644
--- a/database/updates.inc
+++ b/database/updates.inc
@@ -1293,22 +1293,22 @@ function system_update_164() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
- $ret[] = update_sql('CREATE TABLE {poll_votes} (
+ $ret[] = update_sql("CREATE TABLE {poll_votes} (
nid int(10) unsigned NOT NULL,
- uid int(10) unsigned NOT NULL,
- hostname varchar(128) NOT NULL,
+ uid int(10) unsigned NOT NULL default 0,
+ hostname varchar(128) NOT NULL default '',
INDEX (nid),
INDEX (uid),
INDEX (hostname)
- )');
+ )");
break;
case 'pgsql':
- $ret[] = update_sql('CREATE TABLE {poll_votes} (
- nid int(10) NOT NULL,
- uid int(10) NOT NULL,
- hostname varchar(128) NOT NULL
- )');
+ $ret[] = update_sql("CREATE TABLE {poll_votes} (
+ nid int NOT NULL,
+ uid int NOT NULL default 0,
+ hostname varchar(128) NOT NULL default ''
+ )");
$ret[] = update_sql('CREATE INDEX {poll_votes}_nid_idx ON {poll_votes} (nid)');
$ret[] = update_sql('CREATE INDEX {poll_votes}_uid_idx ON {poll_votes} (uid)');
$ret[] = update_sql('CREATE INDEX {poll_votes}_hostname_idx ON {poll_votes} (hostname)');
@@ -1329,16 +1329,7 @@ function system_update_164() {
}
}
- switch ($GLOBALS['db_type']) {
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql('ALTER TABLE {poll} DROP polled');
- break;
-
- case 'pgsql':
- $ret[] = update_sql('ALTER TABLE {poll} RENAME polled TO polled_old');
- break;
- }
+ $ret[] = update_sql('ALTER TABLE {poll} DROP polled');
return $ret;
}
diff --git a/modules/poll.module b/modules/poll.module
index d3385000b..8ea1cd3e5 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -87,6 +87,7 @@ function poll_cron() {
function poll_delete($node) {
db_query("DELETE FROM {poll} WHERE nid = %d", $node->nid);
db_query("DELETE FROM {poll_choices} WHERE nid = %d", $node->nid);
+ db_query("DELETE FROM {poll_votes} WHERE nid = %d", $node->nid);
}
/**
@@ -482,6 +483,7 @@ function poll_update($node) {
db_query('UPDATE {poll} SET runtime = %d, active = %d WHERE nid = %d', $node->runtime, $node->active, $node->nid);
db_query('DELETE FROM {poll_choices} WHERE nid = %d', $node->nid);
+ db_query('DELETE FROM {poll_votes} WHERE nid = %d', $node->nid);
foreach ($node->choice as $choice) {
$chvotes = (int)$choice['chvotes'];
$chtext = $choice['chtext'];
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index d3385000b..8ea1cd3e5 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -87,6 +87,7 @@ function poll_cron() {
function poll_delete($node) {
db_query("DELETE FROM {poll} WHERE nid = %d", $node->nid);
db_query("DELETE FROM {poll_choices} WHERE nid = %d", $node->nid);
+ db_query("DELETE FROM {poll_votes} WHERE nid = %d", $node->nid);
}
/**
@@ -482,6 +483,7 @@ function poll_update($node) {
db_query('UPDATE {poll} SET runtime = %d, active = %d WHERE nid = %d', $node->runtime, $node->active, $node->nid);
db_query('DELETE FROM {poll_choices} WHERE nid = %d', $node->nid);
+ db_query('DELETE FROM {poll_votes} WHERE nid = %d', $node->nid);
foreach ($node->choice as $choice) {
$chvotes = (int)$choice['chvotes'];
$chtext = $choice['chtext'];