#70504 by pwolanin. Add key on {files}.nid.

5.x
Neil Drumm 2006-11-30 02:19:38 +00:00
parent dca26f5ebd
commit ceb346b741
1 changed files with 5 additions and 1 deletions

View File

@ -236,7 +236,8 @@ function system_install() {
filepath varchar(255) NOT NULL default '',
filemime varchar(255) NOT NULL default '',
filesize int unsigned NOT NULL default 0,
PRIMARY KEY (fid)
PRIMARY KEY (fid),
KEY nid (nid)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {file_revisions} (
@ -702,6 +703,7 @@ function system_install() {
filesize int_unsigned NOT NULL default 0,
PRIMARY KEY (fid)
)");
db_query("CREATE INDEX {files}_nid_idx ON {files} (nid)");
db_query("CREATE TABLE {file_revisions} (
fid int_unsigned NOT NULL default 0,
@ -3296,9 +3298,11 @@ function system_update_1012() {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {file_revisions} ADD INDEX(vid)");
$ret[] = update_sql("ALTER TABLE {files} ADD INDEX(nid)");
break;
case 'pgsql':
$ret[] = update_sql('CREATE INDEX {file_revisions}_vid_idx ON {file_revisions} (vid)');
$ret[] = update_sql('CREATE INDEX {files}_nid_idx ON {files} (nid)');
break;
}
return $ret;