|
|
@@ -24,6 +24,30 @@ CREATE TABLE `company` (
|
|
|
PRIMARY KEY (`id_company`)
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
|
|
|
|
|
|
+/*Table structure for table `driver` */
|
|
|
+
|
|
|
+DROP TABLE IF EXISTS `driver`;
|
|
|
+
|
|
|
+CREATE TABLE `driver` (
|
|
|
+ `id_driver` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
+ `name` varchar(64) DEFAULT NULL,
|
|
|
+ `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
+ PRIMARY KEY (`id_driver`)
|
|
|
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
|
|
|
+
|
|
|
+/*Table structure for table `driver_company` */
|
|
|
+
|
|
|
+DROP TABLE IF EXISTS `driver_company`;
|
|
|
+
|
|
|
+CREATE TABLE `driver_company` (
|
|
|
+ `id_driver` int(10) unsigned NOT NULL,
|
|
|
+ `id_company` smallint(5) unsigned NOT NULL,
|
|
|
+ PRIMARY KEY (`id_driver`,`id_company`),
|
|
|
+ KEY `id_company` (`id_company`),
|
|
|
+ CONSTRAINT `driver_company_ibfk_1` FOREIGN KEY (`id_driver`) REFERENCES `driver` (`id_driver`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
|
+ CONSTRAINT `driver_company_ibfk_2` FOREIGN KEY (`id_company`) REFERENCES `company` (`id_company`) ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
|
+
|
|
|
/*Table structure for table `file` */
|
|
|
|
|
|
DROP TABLE IF EXISTS `file`;
|
|
|
@@ -44,7 +68,7 @@ CREATE TABLE `file` (
|
|
|
UNIQUE KEY `filename` (`md5_hash`,`size`),
|
|
|
KEY `id_company` (`id_company`),
|
|
|
CONSTRAINT `file_ibfk_1` FOREIGN KEY (`id_company`) REFERENCES `company` (`id_company`) ON UPDATE CASCADE
|
|
|
-) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
|
|
|
+) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
|
|
|
|
|
|
/*Table structure for table `file_row` */
|
|
|
|
|
|
@@ -77,10 +101,15 @@ CREATE TABLE `file_row` (
|
|
|
`cube` decimal(10,0) DEFAULT NULL COMMENT '42.00',
|
|
|
`date_processed` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`status` varchar(16) DEFAULT NULL COMMENT '"ok" or "fail"',
|
|
|
+ `id_driver` int(10) unsigned DEFAULT NULL,
|
|
|
+ `trailer` varchar(32) DEFAULT NULL,
|
|
|
+ `date_canceled` timestamp NULL DEFAULT NULL,
|
|
|
PRIMARY KEY (`id_file_row`),
|
|
|
UNIQUE KEY `id_file` (`id_file`,`row_number`),
|
|
|
- CONSTRAINT `file_row_ibfk_1` FOREIGN KEY (`id_file`) REFERENCES `file` (`id_file`) ON UPDATE CASCADE
|
|
|
-) ENGINE=InnoDB AUTO_INCREMENT=334 DEFAULT CHARSET=latin1;
|
|
|
+ KEY `id_driver` (`id_driver`),
|
|
|
+ CONSTRAINT `file_row_ibfk_1` FOREIGN KEY (`id_file`) REFERENCES `file` (`id_file`) ON UPDATE CASCADE,
|
|
|
+ CONSTRAINT `file_row_ibfk_2` FOREIGN KEY (`id_driver`) REFERENCES `driver` (`id_driver`) ON UPDATE CASCADE
|
|
|
+) ENGINE=InnoDB AUTO_INCREMENT=360 DEFAULT CHARSET=latin1;
|
|
|
|
|
|
/*Table structure for table `file_row_update` */
|
|
|
|
|
|
@@ -99,7 +128,7 @@ CREATE TABLE `file_row_update` (
|
|
|
KEY `id_record` (`id_file_row`),
|
|
|
CONSTRAINT `file_row_update_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON UPDATE CASCADE,
|
|
|
CONSTRAINT `file_row_update_ibfk_2` FOREIGN KEY (`id_file_row`) REFERENCES `file_row` (`id_file_row`) ON UPDATE CASCADE
|
|
|
-) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
|
|
|
+) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
|
|
|
|
|
|
/*Table structure for table `user` */
|
|
|
|