CREATE DATABASE weavedb;
USE weavedb;
CREATE TABLE `collections` (
`userid` int(11) NOT NULL,
`collectionid` smallint(6) NOT NULL,
`name` varchar(32) NOT NULL,
PRIMARY KEY (`userid`,`collectionid`),
KEY `nameindex` (`userid`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(32) DEFAULT NULL,
`password_hash` varbinary(128) DEFAULT NULL,
`email` varbinary(64) DEFAULT NULL,
`status` tinyint(4) DEFAULT '1',
`alert` text,
`reset` varbinary(32) DEFAULT NULL,
`reset_expiration` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
CREATE TABLE `wbo` (
`username` int(11) NOT NULL,
`collection` smallint(6) NOT NULL DEFAULT '0',
`id` varbinary(64) NOT NULL DEFAULT '',
`parentid` varbinary(64) DEFAULT NULL,
`predecessorid` varbinary(64) DEFAULT NULL,
`sortindex` int(11) DEFAULT NULL,
`modified` bigint(20) DEFAULT NULL,
`payload` longtext,
`payload_size` int(11) DEFAULT NULL,
`ttl` int(11) DEFAULT '2100000000',
PRIMARY KEY (`username`,`collection`,`id`),
KEY `parentindex` (`username`,`collection`,`parentid`),
KEY `modified` (`username`,`collection`,`modified`),
KEY `weightindex` (`username`,`collection`,`sortindex`),
KEY `predecessorindex` (`username`,`collection`,`predecessorid`),
KEY `size_index` (`username`,`payload_size`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;