-- SHOW GRANTS FOR `gerd`@`localhost`;
-- CREATE DATABASE `wombat` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
-- GRANT ALL PRIVILEGES ON `wombat`.* TO `gerd`@`localhost`;
-- FLUSH PRIVILEGES;
-- USE `wombat`;


-- User management
CREATE TABLE `wbuser` (
  `uid` int(11) NOT NULL AUTO_INCREMENT,
  `nickname` varchar(255) NOT NULL default '',
  `password` varchar(32) NOT NULL default '',
  `surname` varchar(255) NOT NULL default '',
  `forename` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  `created` datetime NOT NULL default '0000-00-00 00:00:00',
  `changed` datetime NOT NULL,
  `lastlogin` datetime NOT NULL default '0000-00-00 00:00:00',
  `lang` varchar(10) NOT NULL default '',
  `flags` set('enabled','approved','new') default NULL,
  `deleted`	tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY  (`uid`),
  KEY `email` (`email`),
  KEY `nickname` (`nickname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='users';

CREATE TABLE `wbgroup` (
  `gid` int(11) AUTO_INCREMENT,
  `groupname` varchar(255) NOT NULL default 'maypor',
  PRIMARY KEY  (`gid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='named user group';

CREATE TABLE `wbusergroup` (
  `gid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  KEY `nickname` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='relation of users in group';

CREATE TABLE `wbskin` (
  `uid` int(11) NOT NULL,
  `car` varchar(255) NOT NULL default 'maypor',
  `color` varchar(255) NOT NULL default 'black',
  PRIMARY KEY  (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='user skins';

-- VFS
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(20) NOT NULL,
  `mimeminor` varchar(20) NOT NULL,
  `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` )
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='media file';

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


CREATE TABLE `wbvfsfilequeue` (
  `vfsfid` int(11) NOT NULL,
  `created` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`vfsfid`),
  KEY ( `created` )
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='media file queue';

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` ),
  KEY ( `uid` )
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='store per user folders';


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,
  `created` datetime NOT NULL default '0000-00-00 00:00:00',
  `changed` datetime NOT NULL,
  PRIMARY KEY  (`vfsuid`),
  KEY ( `uid` )
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='media file upload';
