2019-10-04 12:27:55 +00:00
|
|
|
USE `vn`;
|
2019-09-26 08:08:37 +00:00
|
|
|
|
2019-10-04 12:27:55 +00:00
|
|
|
CREATE TABLE `vn`.`zoneWarehouse` (
|
2019-09-26 08:08:37 +00:00
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
|
`zoneFk` int(11) NOT NULL,
|
|
|
|
`warehouseFk` smallint(6) unsigned NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
UNIQUE KEY `zoneFk` (`zoneFk`,`warehouseFk`),
|
|
|
|
KEY `warehouseFk` (`warehouseFk`),
|
|
|
|
CONSTRAINT `zoneWarehouse_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
|
|
CONSTRAINT `zoneWarehouse_ibfk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`)
|
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
|
|
|
|
|
2019-10-04 12:27:55 +00:00
|
|
|
CREATE TABLE `vn`.`zoneEvent` (
|
2019-09-26 08:08:37 +00:00
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`zoneFk` int(11) NOT NULL,
|
|
|
|
`from` date DEFAULT NULL,
|
|
|
|
`to` date DEFAULT NULL,
|
|
|
|
`weekDays` set('mon','tue','wed','thu','fri','sat','sun') NOT NULL,
|
|
|
|
`hour` datetime DEFAULT NULL,
|
|
|
|
`travelingDays` int(11) DEFAULT NULL,
|
|
|
|
`price` decimal(10,2) DEFAULT NULL,
|
|
|
|
`bonus` decimal(10,2) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `zoneFk` (`zoneFk`),
|
|
|
|
CONSTRAINT `zoneEvent_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;
|
|
|
|
|
2019-10-04 12:27:55 +00:00
|
|
|
CREATE TABLE `vn`.`zoneExclusion` (
|
2019-09-26 08:08:37 +00:00
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`zoneFk` int(11) NOT NULL,
|
|
|
|
`day` date NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
UNIQUE KEY `zoneFk_2` (`zoneFk`,`day`),
|
|
|
|
KEY `zoneFk` (`zoneFk`),
|
|
|
|
CONSTRAINT `zoneExclusion_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
|
|
|
|
|