Skip to content

Instantly share code, notes, and snippets.

/tables.sql Secret

Created March 15, 2017 19:45
Show Gist options
  • Save anonymous/e5eb3bf1a10f9d762cc20a8146acf866 to your computer and use it in GitHub Desktop.
Save anonymous/e5eb3bf1a10f9d762cc20a8146acf866 to your computer and use it in GitHub Desktop.
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `Item`
-- ----------------------------
DROP TABLE IF EXISTS `Item`;
CREATE TABLE `Item` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`uri` varchar(255) DEFAULT NULL,
`description` text,
`md5` varchar(255) DEFAULT NULL,
`type` tinyint(2) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`user_id` int(4) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `md5` (`md5`) USING BTREE,
KEY `user_id` (`user_id`),
KEY `id` (`id`,`type`,`user_id`),
CONSTRAINT `item_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13157 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Table structure for `ItemKeyword`
-- ----------------------------
DROP TABLE IF EXISTS `ItemKeyword`;
CREATE TABLE `ItemKeyword` (
`itemID` int(10) unsigned NOT NULL,
`keywordID` int(10) unsigned NOT NULL,
PRIMARY KEY (`ItemID`,`keywordID`),
UNIQUE KEY `uc` (`ItemID`,`keywordID`) USING BTREE,
KEY `keywordID` (`keywordID`),
KEY `itemID` (`itemID`,`keywordID`),
CONSTRAINT `Itemkeyword_ibfk_1` FOREIGN KEY (`keywordID`) REFERENCES `Keyword` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `Itemkeyword_ibfk_2` FOREIGN KEY (`itemID`) REFERENCES `Item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Table structure for `Combination`
-- ----------------------------
DROP TABLE IF EXISTS `Combination`;
CREATE TABLE `Combination` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`hash` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `hash` (`hash`)
) ENGINE=InnoDB AUTO_INCREMENT=46484 DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment