blogapi.install in Drupal 5
File
modules/blogapi/blogapi.install
View source
<?php
function blogapi_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {blogapi_files} (\n fid int NOT NULL auto_increment,\n uid int unsigned NOT NULL default 0,\n filepath varchar(255) NOT NULL default '',\n filesize int unsigned NOT NULL default 0,\n PRIMARY KEY (fid),\n KEY uid (uid)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
break;
case 'pgsql':
db_query("CREATE TABLE {blogapi_files} (\n fid serial,\n uid int_unsigned NOT NULL default 0,\n filepath varchar(255) NOT NULL default '',\n filesize int_unsigned NOT NULL default 0,\n PRIMARY KEY (fid)\n )");
db_query("CREATE INDEX {blogapi_files}_uid_idx ON {blogapi_files} (uid)");
break;
}
}
function blogapi_uninstall() {
db_query("DROP TABLE {blogapi_files}");
}
function blogapi_update_5000() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("CREATE TABLE {blogapi_files} (\n fid int NOT NULL auto_increment,\n uid int unsigned NOT NULL default 0,\n filepath varchar(255) NOT NULL default '',\n filesize int unsigned NOT NULL default 0,\n PRIMARY KEY (fid),\n KEY uid (uid)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
break;
case 'pgsql':
$ret[] = update_sql("CREATE TABLE {blogapi_files} (\n fid serial,\n uid int_unsigned NOT NULL default 0,\n filepath varchar(255) NOT NULL default '',\n filesize int_unsigned NOT NULL default 0,\n PRIMARY KEY (fid)\n )");
$ret[] = update_sql("CREATE INDEX {blogapi_files}_uid_idx ON {blogapi_files} (uid)");
break;
}
return $ret;
}