summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/system/system.install16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 1714424f4..97f32e095 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -4418,7 +4418,23 @@ function system_update_6032() {
function system_update_6033() {
$ret = array();
if (db_table_exists('node_comment_statistics')) {
+ // On pgsql but not mysql, db_change_field() drops all keys
+ // involving the changed field, which in this case is the primary
+ // key. The normal approach is explicitly drop the pkey, change the
+ // field, and re-create the pkey.
+ //
+ // Unfortunately, in this case that won't work on mysql; we CANNOT
+ // drop the pkey because on mysql auto-increment fields must be
+ // included in at least one key or index.
+ //
+ // Since we cannot drop the pkey before db_change_field(), after
+ // db_change_field() we may or may not still have a pkey. The
+ // simple way out is to re-create the pkey only when using pgsql.
+ // Realistic requirements trump idealistic purity.
db_change_field($ret, 'node_comment_statistics', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
+ if ($GLOBALS['db_type'] == 'pgsql') {
+ db_add_primary_key($ret, 'node_comment_statistics', array('nid'));
+ }
}
return $ret;
}