You are here

function download_count_install in Download Count 5

Same name and namespace in other branches
  1. 6.2 download_count.install \download_count_install()
  2. 6 download_count.install \download_count_install()
  3. 7.2 download_count.install \download_count_install()

File

./download_count.install, line 3

Code

function download_count_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE if not exists {file_downloads} (\n        filename varchar(255) character set utf8 NOT NULL,\n        count int(11) NOT NULL default '0',\n\t\ttimestamp int(11) NOT NULL default '0',\n\t\tUNIQUE KEY filename (filename)\n\t\t) /*!40100 DEFAULT CHARACTER SET utf8 */");
      break;
    case 'pgsql':
      db_query("CREATE TABLE if not exists {file_downloads} (\n        did serial NOT NULL,\n        filename character varying(255) NOT NULL,\n        count integer DEFAULT 0 NOT NULL,\n         \"timestamp\" integer DEFAULT 0 NOT NULL\n        )");
      db_query("ALTER TABLE ONLY {file_downloads} ADD CONSTRAINT {file_downloads}_pkey PRIMARY KEY (did)");
      break;
  }
}