Thanks,
I added all of these lines and it began to work but it misses the constraints for table codes and i don't know what they are for the moment ?
Lines i need now :
--
-- Constraints for table `codes`
--
ALTER TABLE `codes`
ADD CONSTRAINT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ON DELETE CASCADE ON UPDATE CASCADE;
Lines i added for the moment :
CREATE TABLE `codes` (
`code_id` int(11) NOT NULL,
`type` enum('DISCOUNT','REDEEMABLE') DEFAULT NULL,
`days` int(11) DEFAULT NULL,
`package_id` int(11) DEFAULT NULL,
`code` varchar(64) DEFAULT NULL,
`discount` varchar(64) DEFAULT NULL,
`quantity` int(11) DEFAULT NULL,
`date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE `codes`
ADD PRIMARY KEY (`code_id`),
ADD KEY `package_id` (`package_id`);
ALTER TABLE `codes`
MODIFY `code_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
In red the types i'm not sure they are correct.
Thanks for your help ?