17 lines
411 B
SQL
17 lines
411 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`collection_kill`(vSelf INT)
|
|
BEGIN
|
|
/**
|
|
* Elimina una coleccion y coloca sus tickets en OK
|
|
*/
|
|
INSERT INTO ticketTracking(stateFk, ticketFk)
|
|
SELECT s.id, ticketFk
|
|
FROM vn.ticketCollection tc
|
|
JOIN vn.state s ON s.code = 'OK'
|
|
WHERE tc.collectionFk = vSelf;
|
|
|
|
DELETE FROM vn.collection
|
|
WHERE id = vSelf;
|
|
END$$
|
|
DELIMITER ;
|