You are here

function asset_install in Asset 5.2

Same name and namespace in other branches
  1. 5 asset.install \asset_install()
  2. 6 asset.install \asset_install()
  3. 7 asset.install \asset_install()

Implementation of hook_install()

File

./asset.install, line 11
Asset module install file

Code

function asset_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {asset} (\n        aid int unsigned NOT NULL,\n        type varchar(32) NOT NULL default '',\n        title varchar(128) NOT NULL default '',\n        uid int NOT NULL default '0',\n        status int NOT NULL default '1',\n        created int NOT NULL default '0',\n        changed int NOT NULL default '0',\n        pid int unsigned NOT NULL,\n        credit varchar(255) NOT NULL,\n        description text NOT NULL,\n        PRIMARY KEY  (aid)\n      ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {asset_node} (\n        aid int(10) unsigned NOT NULL,\n        nid int(10) unsigned NOT NULL,\n        refs int(10) unsigned NOT NULL default '0',\n        PRIMARY KEY  (aid,nid)\n      ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {asset_files} (\n        aid int unsigned NOT NULL default 0,\n        fid int unsigned NOT NULL default 0,\n        label varchar(32) NOT NULL,\n        PRIMARY KEY  (aid)\n      ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {asset_role} (\n        aid int(10) unsigned NOT NULL,\n        rid int(10) unsigned NOT NULL,\n        status tinyint unsigned NOT NULL default '0',\n        PRIMARY KEY  (aid,rid)\n      ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':

      //TODO: postgresql
      break;
  }
  drupal_set_message(t('Asset tables have been configured.'));
}