+--
+-- Table structure for table `misc_files`
+--
+
+CREATE TABLE IF NOT EXISTS `misc_files` ( -- miscellaneous files attached to records from various tables
+ `file_id` int(11) NOT NULL AUTO_INCREMENT, -- unique id for the file record
+ `table_tag` varchar(255) NOT NULL, -- usually table name, or arbitrary unique tag
+ `record_id` int(11) NOT NULL, -- record id from the table this file is associated to
+ `file_name` varchar(255) NOT NULL, -- file name
+ `file_type` varchar(255) NOT NULL, -- MIME type of the file
+ `file_description` varchar(255) DEFAULT NULL, -- description given to the file
+ `file_content` longblob NOT NULL, -- file content
+ `date_uploaded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- date and time the file was added
+ PRIMARY KEY (`file_id`),
+ KEY `table_tag` (`table_tag`),
+ KEY `record_id` (`record_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+