You are here

function blogapi_update_5000 in Drupal 5

Add blogapi_files table to enable size restriction for BlogAPI file uploads.

Added in Drupal 5.10 (and 6.4).

Related topics

File

modules/blogapi/blogapi.install, line 54

Code

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;
}