Open geantas opened 3 years ago
Is the table definition missing an "ON DELETE CASCADE" for the "discount_reward_products_discount_reward_id_foreign" foreign key?
CREATE TABLE `discount_reward_products` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`product_id` int unsigned NOT NULL,
`discount_reward_id` int unsigned NOT NULL,
`quantity` int NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `discount_reward_products_discount_reward_id_foreign` (`discount_reward_id`),
KEY `discount_reward_products_product_id_foreign` (`product_id`),
CONSTRAINT `discount_reward_products_discount_reward_id_foreign` FOREIGN KEY (`discount_reward_id`) REFERENCES `discount_rewards` (`id`),
CONSTRAINT `discount_reward_products_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
Describe the bug When updating a discount through an API, it throws an error related to SQL:
To Reproduce
201
wz6d39dj
).Expected behavior Server returns a response with status 200.