summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-04 15:00:21 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-04 15:00:21 +0000
commit0d577cbf7a6ad49f6b2f0f79f0f324f6c2ce8bd0 (patch)
tree5de63961fdf62de185d7bf5ac957c9adba5ca21b
parenta6407c2a2445a2542eb34efda30e5de59cf38576 (diff)
downloadbrdo-0d577cbf7a6ad49f6b2f0f79f0f324f6c2ce8bd0.tar.gz
brdo-0d577cbf7a6ad49f6b2f0f79f0f324f6c2ce8bd0.tar.bz2
#179143 by chx and agentrickard: unify update code for files, fixing postgresql bugs with it
-rw-r--r--modules/system/system.install16
1 files changed, 2 insertions, 14 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 2ddfffb46..60d5046d7 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -4221,20 +4221,8 @@ function system_update_6022() {
db_add_index($ret, 'upload', 'vid', array('vid'));
// The nid column was renamed to uid. Use the old nid to find the node's uid.
- switch ($GLOBALS['db_type']) {
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql('UPDATE {files} f JOIN {node} n ON f.uid = n.nid SET f.uid = n.uid');
- // Use the existing vid to find the nid.
- $ret[] = update_sql('UPDATE {upload} u JOIN {node_revisions} r ON u.vid = r.vid SET u.nid = r.nid');
- break;
-
- case 'pgsql':
- $ret[] = update_sql('UPDATE {files} AS f SET uid = n.uid FROM {node} n WHERE f.uid=n.nid');
- // Use the existing vid to find the nid.
- $ret[] = update_sql('UPDATE {upload} AS u SET nid = r.nid FROM {node_revisions} r WHERE u.vid = r.vid');
- break;
- }
+ update_sql('UPDATE {files} SET uid = (SELECT n.uid FROM {node} n WHERE {files}.uid = n.nid)');
+ update_sql('UPDATE {upload} SET nid = (SELECT r.nid FROM {node_revisions} r WHERE {upload}.vid = r.vid)');
// Mark all existing files as FILE_STATUS_PERMANENT.
$ret[] = update_sql('UPDATE {files} SET status = 1');