diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-05-15 20:56:48 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-05-15 20:56:48 +0000 |
commit | 75a777a3ea3e6c9c6ab1f8508dfe8feffe5da88d (patch) | |
tree | 3ead9dee57e218bb0afb4787319ab03e8adda730 /modules/system | |
parent | 756131a862b3f496846b02e2629d13fc35a084e5 (diff) | |
download | brdo-75a777a3ea3e6c9c6ab1f8508dfe8feffe5da88d.tar.gz brdo-75a777a3ea3e6c9c6ab1f8508dfe8feffe5da88d.tar.bz2 |
- Patch #193076 by quicksketch, dmitrig01 and paul.lovvik: drag and drop support for poll module.
Diffstat (limited to 'modules/system')
-rw-r--r-- | modules/system/system.install | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/system/system.install b/modules/system/system.install index 89c2afde2..7e2d240b7 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2997,6 +2997,27 @@ function system_update_7007() { /** + * Use the poll_choice primary key to record votes in poll_votes rather than + * the choice order. Rename chorder to weight. + */ +function system_update_7008() { + $ret = array(); + if (db_table_exists('poll_votes')) { + // Add chid column and convert existing votes. + db_add_field($ret, 'poll_votes', 'chid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_add_index($ret, 'poll_votes', 'chid', array('chid')); + $ret[] = update_sql("UPDATE {poll_votes} v SET chid = (SELECT chid FROM {poll_choices} c WHERE v.chorder = c.chorder AND v.nid = c.nid)"); + // Remove old chorder column. + db_drop_field($ret, 'poll_votes', 'chorder'); + } + if (db_table_exists('poll_choices')) { + // Change the chorder column to weight in poll_choices. + db_change_field($ret, 'poll_choices', 'chorder', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); + } + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ |