1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
CREATE TABLE IF NOT EXISTS `dat_summaries` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_customer` int(10) UNSIGNED NOT NULL,
`id_filter` int(10) UNSIGNED DEFAULT NULL,
`id_salesagent` int(10) UNSIGNED DEFAULT NULL,
`contacttype` tinyint(2) DEFAULT NULL,
`date_contact` date DEFAULT NULL,
`content` text,
`create_date` datetime DEFAULT CURRENT_TIMESTAMP,
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `id_customer` (`id_customer`) USING BTREE,
KEY `id_filter` (`id_filter`) USING BTREE,
KEY `dat_summaries_ibfk_2` (`id_salesagent`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8;
ALTER TABLE `dat_summaries`
ADD CONSTRAINT `dat_summaries_ibfk_1` FOREIGN KEY (`id_customer`) REFERENCES `dat_customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `dat_summaries_ibfk_2` FOREIGN KEY (`id_salesagent`) REFERENCES `lst_salesagents` (`id`) ON UPDATE CASCADE,
ADD CONSTRAINT `dat_summaries_ibfk_3` FOREIGN KEY (`id_filter`) REFERENCES `lst_filters` (`id`) ON UPDATE CASCADE;
COMMIT; |
Partager