
DROP TABLE IF EXISTS wbvfsfile;
CREATE TABLE `wbvfsfile` (
  `vfsfid` int(11) NOT NULL AUTO_INCREMENT,
  `obscure` varchar(2) NOT NULL,
  `vfsdid` int(11) NOT NULL,
  `uid` varchar(255) NOT NULL,
  `size` int(11) NOT NULL DEFAULT '0',
  `md5` varchar(32) NOT NULL,
  `storage` varchar(255) NOT NULL,
  `mimemajor` varchar(75) NOT NULL DEFAULT '',
  `mimeminor` varchar(75) NOT NULL DEFAULT '',
  `views` int(11) NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL DEFAULT '',
  `description` varchar(255) NOT NULL DEFAULT '',
  `info` blob,
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `changed` datetime NOT NULL,
  `deleted` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`vfsfid`),
  KEY `uid` (`uid`)
) ENGINE=MyISAM AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT='media file';

DROP TABLE IF EXISTS wbvfsfilequota;
CREATE TABLE `wbvfsfilequota` (
  `uid` int(11) NOT NULL,
  `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `sizemax` int(11) unsigned NOT NULL DEFAULT '104857600',
  `filemax` int(11) unsigned NOT NULL DEFAULT '1000',
  PRIMARY KEY (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='media file per user quota';

DROP TABLE IF EXISTS wbvfsfileupload;
CREATE TABLE `wbvfsfileupload` (
  `vfsuid` int(11) NOT NULL AUTO_INCREMENT,
  `uid` varchar(255) NOT NULL,
  `size` int(11) NOT NULL DEFAULT '0',
  `md5` varchar(32) NOT NULL,
  `chunks` varchar(255) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `changed` datetime NOT NULL,
  PRIMARY KEY (`vfsuid`),
  KEY `uid` (`uid`)
) ENGINE=MyISAM AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT='media file upload';

DROP TABLE IF EXISTS wbvfsdir;
CREATE TABLE `wbvfsdir` (
  `vfsdid` int(11) NOT NULL AUTO_INCREMENT,
  `uid` varchar(255) NOT NULL,
  `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
  `name` varchar(255) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `changed` datetime NOT NULL,
  PRIMARY KEY (`vfsdid`),
  KEY `path` (`path`),
  KEY `uid` (`uid`)
) ENGINE=MyISAM AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT='store per user folders';

DROP TABLE IF EXISTS wbvfsfileview;
CREATE TABLE `wbvfsfileview` (
  `vfsfid` int(11) NOT NULL,
  `uid` varchar(255) NOT NULL,
  `addr` varchar(32) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `trackid` char(32) NOT NULL DEFAULT '',
  KEY `vfsfid` (`vfsfid`),
  KEY `uid` (`uid`),
  KEY `created` (`created`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='media file views';

DROP TABLE IF EXISTS wbvfsgallery;
CREATE TABLE wbvfsgallery (
  vfsgid int(11) NOT NULL AUTO_INCREMENT,
  obscure varchar(2) NOT NULL,
  uid varchar(255) NOT NULL,
  title varchar(255) NOT NULL DEFAULT '',
  description blob,
  created datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  changed datetime NOT NULL,
  deleted tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (vfsgid),
  KEY uid (uid)
) ENGINE=MyISAM AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 COMMENT='media file gallery';

DROP TABLE IF EXISTS wbvfsgalleryfile;
CREATE TABLE wbvfsgalleryfile (
  vfsgid int(11) NOT NULL,
  vfsfid int(11) NOT NULL,
  KEY vfsgid (vfsgid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='media file gallery file reference';
