Re: From production to archive ..
Posted by:
Mike Moran
Date: October 30, 2012 10:50AM
Rick James Wrote:
-------------------------------------------------------
> Let's see SHOW CREATE TABLE.
>
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
`order_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_type_id` int(10) unsigned NOT NULL,
`project_id` int(10) unsigned NOT NULL,
`status_id` int(10) unsigned NOT NULL DEFAULT '110',
`priority` int(10) unsigned NOT NULL DEFAULT '10',
`source_id` int(10) unsigned DEFAULT NULL,
`source_seq` int(10) unsigned DEFAULT NULL,
`print_site_id` int(10) unsigned DEFAULT NULL,
`ship_site_id` int(10) unsigned DEFAULT NULL,
`order_note` tinytext,
`date_received` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_due` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`date_status` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`date_done` datetime DEFAULT NULL,
PRIMARY KEY (`order_id`),
KEY `order_status_fk` (`status_id`),
KEY `order_type_fk` (`order_type_id`),
KEY `order_project_fk` (`project_id`),
KEY `order_source_fk` (`source_id`),
KEY `orders_print_fk` (`print_site_id`),
KEY `orders_ship_fk` (`ship_site_id`),
KEY `order_proj_status_idx` (`project_id`,`status_id`),
KEY `order_date_done_idx` (`date_done`),
KEY `order_date_status_idx` (`date_status`),
KEY `order_psd_idx` (`project_id`,`status_id`,`date_done`),
KEY `order_pstd_idx` (`order_type_id`,`project_id`,`status_id`,`date_done`),
KEY `order_done_project_type_status_idx` (`date_done`,`project_id`,`order_type_id`,`status_id`),
KEY `orders_status_priority_idx` (`status_id`,`priority`),
CONSTRAINT `orders_print_fk` FOREIGN KEY (`print_site_id`) REFERENCES `type_sites` (`site_id`),
CONSTRAINT `orders_ship_fk` FOREIGN KEY (`ship_site_id`) REFERENCES `type_sites` (`site_id`),
CONSTRAINT `order_project_fk` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`),
CONSTRAINT `order_source_fk` FOREIGN KEY (`source_id`) REFERENCES `sources` (`source_id`),
CONSTRAINT `order_status_fk` FOREIGN KEY (`status_id`) REFERENCES `type_order_statuses` (`status_id`),
CONSTRAINT `order_type_fk` FOREIGN KEY (`order_type_id`) REFERENCES `type_order_types` (`order_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=14150912 DEFAULT CHARSET=latin1;