2024-04-25 17:02:05 +00:00
|
|
|
CREATE OR REPLACE TABLE `vn`.`farmingDeliveryNote` (
|
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
|
`farmingFk` int(10) unsigned NOT NULL,
|
|
|
|
`deliveryNoteFk` int(11) NOT NULL,
|
|
|
|
`amount` decimal(10,2) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `farmingDeliveryNoteFk_FK` (`deliveryNoteFk`),
|
|
|
|
KEY `farmingDeliveryNoteFk_FK_1` (`farmingFk`),
|
|
|
|
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
|
2024-04-25 17:06:06 +00:00
|
|
|
FROM vn.deliveryNote dn
|
2024-04-25 17:02:05 +00:00
|
|
|
WHERE farmingFk;
|