function webform_update_12 in Webform 5
Same name and namespace in other branches
- 5.2 webform.install \webform_update_12()
- 6.2 webform.install \webform_update_12()
Change 'user' column to 'uid' in webform_submissions table.
File
- ./
webform.install, line 378
Code
function webform_update_12() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {webform_submissions} ADD uid int(10) NOT NULL DEFAULT 0 AFTER sid");
$ret[] = update_sql("UPDATE {webform_submissions} ws set uid = (SELECT uid FROM {users} u WHERE u.name = ws.user)");
$ret[] = update_sql("ALTER TABLE {webform_submissions} DROP user");
break;
case 'pgsql':
$ret[] = update_sql("ALTER TABLE {webform_submissions} ADD uid integer NOT NULL DEFAULT 0");
$ret[] = update_sql("UPDATE {webform_submissions} ws set uid = (SELECT uid FROM {users} u WHERE u.name = ws.user)");
$ret[] = update_sql("ALTER TABLE {webform_submissions} DROP user");
break;
}
return $ret;
}