download_count.install in Download Count 5
File
download_count.install
View source
<?php
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;
}
}
function download_count_uninstall() {
db_query("DROP TABLE {file_downloads}");
}