-- -- TABLE tm_index -- DESCRIPTION one row per template, fields are described in http://www.templatemonster.com/webapi/doc/html/ch02s04.html#id2882345 -- owner_id is 0 for tm. -- CARDINALITY -- tm_index <- (1,1) - (0,n) -> tm_types -- tm_index <- (1,1) - (1,1) -> tm_details -- tm_index <- (1,1) - (0,n) -> tm_authors -- tm_index <- (0,n) - (0,n) -> tm_styles_index WITH : -- tm_index <- (1,1) - (1,1) -> tm_styles -- tm_index <- (0,n) - (1,1) -> tm_pages -- tm_index <- (0,n) - (1,1) -> tm_screenshots CREATE TABLE IF NOT EXISTS `tm_index` ( `id` tinyint (6) NOT NULL auto_increment, `state` tinyint (1) default 0 NULL, `is_hosting` tinyint (1) default 0 NULL, `is_flash` tinyint (1) default 0 NULL, `is_unique` tinyint (1) default 0 NULL, `is_non_unique` tinyint (1) default 0 NULL, `is_unique_corporate` tinyint (1) default 0 NULL, `is_non_unique_corporate` tinyint (1) default 0 NULL, `is_full_size` tinyint (1) default 0 NULL, `is_real_size` tinyint (1) default 0 NULL, `author_id` tinyint (2) default 0 NULL, `type` tinyint (2) default 0 NULL, `owner_id` tinyint (4) default 0 NOT NULL, `price` tinyint (4) default 0 NULL, PRIMARY KEY (`id`), KEY `author_id` (`author_id`), KEY `type` (`type`), KEY `owner_id` (`owner_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 PARTITION BY RANGE(id) ( PARTITION p1 VALUES LESS THAN(1001), PARTITION p2 VALUES LESS THAN(2001), PARTITION p3 VALUES LESS THAN(3001), PARTITION p4 VALUES LESS THAN(4001), PARTITION p5 VALUES LESS THAN(5001), PARTITION p6 VALUES LESS THAN(6001), PARTITION p7 VALUES LESS THAN(7001), PARTITION p8 VALUES LESS THAN(8001), PARTITION p9 VALUES LESS THAN(8001), PARTITION p10 VALUES LESS THAN(9001), PARTITION p11 VALUES LESS THAN(10001), PARTITION p12 VALUES LESS THAN(11001), PARTITION p13 VALUES LESS THAN(12001), PARTITION p14 VALUES LESS THAN MAXVALUE ) -- -- TABLE tm_details -- DESCRIPTION one row per tm details, this is vertical partionning -- CARDINALITY -- tm_details <- (1,1) - (1,1) -> tm_index CREATE TABLE IF NOT EXISTS `tm_details` ( `id_tm` int (6) default 0 NULL, `exc_price` int (6) default 0 NULL, `downloads` int (6) default 0 NULL, `inserted_date` int (10) default 0 NULL, `keywords` varchar (255) default 0 NULL, `software_required` varchar (255) default 0 NULL, KEY (`id_tm`), KEY `keywords` (`keywords`), KEY `software_required` (`software_required`) ) ENGINE=InnoDB AUTO_INCREMENT=1 PARTITION BY RANGE(id) ( PARTITION p1 VALUES LESS THAN(1001), PARTITION p2 VALUES LESS THAN(2001), PARTITION p3 VALUES LESS THAN(3001), PARTITION p4 VALUES LESS THAN(4001), PARTITION p5 VALUES LESS THAN(5001), PARTITION p6 VALUES LESS THAN(6001), PARTITION p7 VALUES LESS THAN(7001), PARTITION p8 VALUES LESS THAN(8001), PARTITION p9 VALUES LESS THAN(8001), PARTITION p10 VALUES LESS THAN(9001), PARTITION p11 VALUES LESS THAN(10001), PARTITION p12 VALUES LESS THAN(11001), PARTITION p13 VALUES LESS THAN(12001), PARTITION p14 VALUES LESS THAN MAXVALUE ); -- -- TABLE tm_types -- DESCRIPTION one row per type -- CARDINALITY -- tm_types <- (0,n) - (1,1) -> tm_index CREATE TABLE IF NOT EXISTS `tm_types` ( `id` tinyint (3) default NULL, `label` varchar (60) default NULL, PRIMARY KEY (`id`), UNIQUE `label` (`label`) ) ENGINE=InnoDB ; -- -- TABLE tm_authors -- DESCRIPTION one row per author -- CARDINALITY -- tm_authors <- (1,1) - (0,n) -> tm_index CREATE TABLE IF NOT EXISTS `tm_authors` ( `id` tinyint (3) default NULL, `tm_author` varchar (60) default NULL, PRIMARY KEY (`id`), UNIQUE `tm_authors` (`tm_authors`) ) ENGINE=InnoDB ; -- -- TABLE tm_styles_index -- DESCRIPTION one row per unique style. -- CARDINALITY -- tm_styles_index <- (1,1) - (0,n) -> tm_styles -- tm_styles_index <- (0,n) - (0,n) -> tm_index CREATE TABLE IF NOT EXISTS `tm_styles_index` ( `id` tinyint (3) default NULL, `label_en` varchar (60) default NULL, `label_fr` varchar (60) default NULL, PRIMARY KEY (`id`), UNIQUE `label` (`label`) ) ENGINE=InnoDB ; -- -- TABLE tm_styles -- DESCRIPTION one row per style of one template -- CARDINALITY -- tm_styles <- (1,1) - (0,n) -> tm_styles_index -- tm_styles <- (1,1) - (0,n) -> tm_index CREATE TABLE IF NOT EXISTS `tm_styles` ( `id_style` tinyint (2) default NULL, `id_tm` int (6) default NULL, KEY `id_style` (`id_style`), KEY `id_tm` (`id_tm`) ) ENGINE=InnoDB ; -- -- TABLE tm_pages -- DESCRIPTION one row per unique page. -- CARDINALITY -- tm_page <- (0,n) - (1,1) -> tm_screenshots -- tm_page <- (1,1) - (0,n) -> tm_index CREATE TABLE IF NOT EXISTS `tm_pages` ( `id` tinyint (10) default NULL, `id_tm` tinyint (6) default NULL, `label` varchar (60) default NULL, PRIMARY KEY (`id`), KEY (`id_tm`), UNIQUE `label` (`label`) ) ENGINE=InnoDB ; -- -- TABLE tm_screenshots -- DESCRIPTION one row per screenshot -- CARDINALITY -- tm_screenshoots <- (0,1) - (0,n) -> tm_page -- tm_screenshoots <- (1,1) - (0,n) -> tm_index CREATE TABLE IF NOT EXISTS `tm_screenshots` ( `id_tm` tinyint (6) default NULL, `id_page` tinyint (10) default NULL, `uri` varchar (50) default NULL, `filetime` int (10) default NULL, KEY `id_tm` (`id_tm`), KEY `id_page` (`id_page`), UNIQUE `uri` (`uri`) ) ENGINE=InnoDB PARTITION BY RANGE(id_tm) ( PARTITION p1 VALUES LESS THAN(1001), PARTITION p2 VALUES LESS THAN(2001), PARTITION p3 VALUES LESS THAN(3001), PARTITION p4 VALUES LESS THAN(4001), PARTITION p5 VALUES LESS THAN(5001), PARTITION p6 VALUES LESS THAN(6001), PARTITION p7 VALUES LESS THAN(7001), PARTITION p8 VALUES LESS THAN(8001), PARTITION p9 VALUES LESS THAN(8001), PARTITION p10 VALUES LESS THAN(9001), PARTITION p11 VALUES LESS THAN(10001), PARTITION p12 VALUES LESS THAN(11001), PARTITION p13 VALUES LESS THAN(12001), PARTITION p14 VALUES LESS THAN MAXVALUE ); -- -- TABLE tm_categories_index -- DESCRIPTION one row per unique category. -- CARDINALITY -- tm_categories_index <- (1,1) - (0,n) -> tm_categories -- tm_categories_index <- (0,n) - (0,n) -> tm_index CREATE TABLE IF NOT EXISTS `tm_cats_index` ( `id` tinyint (3) default NULL, `label_fr` varchar (60) default NULL, `label_en` varchar (60) default NULL, PRIMARY KEY (`id`), UNIQUE `label` (`label`) ) ENGINE=InnoDB ; -- -- TABLE tm_categories -- DESCRIPTION one row per category of one template -- CARDINALITY -- tm_categories <- (1,1) - (0,n) -> tm_categories_index -- tm_categories <- (1,1) - (0,n) -> tm_index CREATE TABLE IF NOT EXISTS `tm_cats` ( `id_cat` tinyint (2) default NULL, `id_tm` int (6) default NULL, KEY `id_cat` (`id_cat`), KEY `id_tm` (`id_tm`) ) ENGINE=InnoDB ; -- -- TABLE tm_config -- DESCRIPTION one row per config var CREATE TABLE IF NOT EXISTS `tm_config` ( `label` varchar (20) default NULL, `val` varchar (20) default NULL, ) ENGINE=InnoDB ;