diff --git a/db/versions/11007-greenRose/00-firstScript.sql b/db/versions/11007-greenRose/00-firstScript.sql index 69959f0b4..154a75532 100644 --- a/db/versions/11007-greenRose/00-firstScript.sql +++ b/db/versions/11007-greenRose/00-firstScript.sql @@ -1,4 +1,3 @@ - CREATE OR REPLACE TABLE `vn`.`farmingDeliveryNote` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `farmingFk` int(10) unsigned NOT NULL, @@ -10,3 +9,8 @@ CREATE OR REPLACE TABLE `vn`.`farmingDeliveryNote` ( CONSTRAINT `farmingDeliveryNoteFk_FK` FOREIGN KEY (`deliveryNoteFk`) REFERENCES `deliveryNote` (`id`), CONSTRAINT `farmingDeliveryNoteFk_FK_1` FOREIGN KEY (`farmingFk`) REFERENCES `farming` (`id`) ); + +INSERT IGNORE INTO `vn`.`farmingDeliveryNote` (farmingFk, deliveryNoteFk, amount) + SELECT farmingFk, id, amount + FROM vn.deliveryNote dn + WHERE farmingFk; \ No newline at end of file