update model ticketRequest and update structure DB
This commit is contained in:
parent
b9699acd7b
commit
81eabac30b
|
@ -0,0 +1,47 @@
|
|||
ALTER TABLE `vn2008`.`Ordenes`
|
||||
ADD COLUMN `isOk` TINYINT(1) NULL DEFAULT NULL AFTER `odbc_date`,
|
||||
ADD COLUMN `requesterFk` INT(11) NULL DEFAULT NULL AFTER `isOk`,
|
||||
ADD COLUMN `atenderFk` INT(11) NULL DEFAULT NULL AFTER `requesterFk`;
|
||||
|
||||
ALTER TABLE `vn2008`.`Ordenes`
|
||||
ADD COLUMN `ticketFk` INT(11) NULL DEFAULT NULL AFTER `atenderFk`;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE `vn2008`.`Ordenes`
|
||||
ADD INDEX `fgnRequester_idx` (`requesterFk` ASC),
|
||||
ADD INDEX `fgnAtender_idx` (`atenderFk` ASC);
|
||||
ALTER TABLE `vn2008`.`Ordenes`
|
||||
ADD CONSTRAINT `fgnRequester`
|
||||
FOREIGN KEY (`requesterFk`)
|
||||
REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fgnAtender`
|
||||
FOREIGN KEY (`atenderFk`)
|
||||
REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fgbMovimiento`
|
||||
FOREIGN KEY (`Id_Movimiento`)
|
||||
REFERENCES `vn2008`.`Movimientos` (`Id_Movimiento`)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `vn2008`.`Ordenes`
|
||||
DROP FOREIGN KEY `fgbMovimiento`;
|
||||
ALTER TABLE `vn2008`.`Ordenes`
|
||||
ADD CONSTRAINT `fgbMovimiento`
|
||||
FOREIGN KEY (`Id_Movimiento`)
|
||||
REFERENCES `vn2008`.`Movimientos` (`Id_Movimiento`)
|
||||
ON DELETE SET NULL
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `vn2008`.`Ordenes`
|
||||
ADD INDEX `fgnTicket_idx` (`ticketFk` ASC);
|
||||
ALTER TABLE `vn2008`.`Ordenes`
|
||||
ADD CONSTRAINT `fgnTicket`
|
||||
FOREIGN KEY (`ticketFk`)
|
||||
REFERENCES `vn2008`.`Tickets` (`Id_Ticket`)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
|
@ -7,12 +7,13 @@ VIEW `ticketRequest` AS
|
|||
SELECT
|
||||
`t`.`Id_ORDEN` AS `id`,
|
||||
`t`.`ORDEN` AS `description`,
|
||||
`t`.`CodVENDEDOR` AS `requestFk`,
|
||||
`t`.`requesterFk` AS `requesterFk`,
|
||||
`t`.`CodCOMPRADOR` AS `atenderFk`,
|
||||
`t`.`CANTIDAD` AS `quantity`,
|
||||
`t`.`PRECIOMAX` AS `price`,
|
||||
`t`.`KO` AS `isOk`,
|
||||
`t`.`Id_Movimiento` AS `saleFk`,
|
||||
`t`.`ticketFk` AS `ticketFk`,
|
||||
`t`.`odbc_date` AS `created`
|
||||
FROM
|
||||
`vn2008`.`Ordenes` `t`;
|
|
@ -1019,9 +1019,9 @@ INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`)
|
|||
(5, 3, 103),
|
||||
(6, 3, 104);
|
||||
|
||||
INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requestFk`, `atenderFk`, `quantity`, `price`, `isOk`, `saleFk`, `created`)
|
||||
INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk`, `quantity`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`)
|
||||
VALUES
|
||||
(1, 'Gem of Time', '018', '035', 5, 9.10, 0, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
|
||||
(2, 'Gem of Mind', '018', '035', 10, 1.07, 0, 2, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
|
||||
(3, 'Mark I', '018', '035', 20, 3.06, 0, 4, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
|
||||
(4, 'Gem of Mind', '018', '035', 15, 1.30, 0, 7, CURDATE());
|
||||
(1, 'Gem of Time', 18, 35, 5, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
|
||||
(2, 'Gem of Mind', 18, 35, 10, 1.07, 0, 2, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
|
||||
(3, 'Mark I', 18, 35, 20, 3.06, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
|
||||
(4, 'Gem of Mind', 18, 35, 15, 1.30, 0, NULL, 11, CURDATE());
|
|
@ -26,14 +26,6 @@
|
|||
},
|
||||
"isOk": {
|
||||
"type": "Boolean"
|
||||
},
|
||||
"atender": {
|
||||
"type": "String",
|
||||
"columnName": "atenderFk"
|
||||
},
|
||||
"requester": {
|
||||
"type": "String",
|
||||
"columnName": "requesterFk"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
@ -41,6 +33,21 @@
|
|||
"type": "belongsTo",
|
||||
"model": "Sale",
|
||||
"foreignKey": "saleFk"
|
||||
},
|
||||
"ticket": {
|
||||
"type": "belongsTo",
|
||||
"model": "Ticket",
|
||||
"foreignKey": "ticketFk"
|
||||
},
|
||||
"atender": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "atenderFk"
|
||||
},
|
||||
"requester": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "requesterFk"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue