use socle;

INSERT INTO `socle`.`menu_solution` (`id`, `menuCode`, `menuLibelle`, `parentId`, `type`) 
VALUES ('28', 'deliveryNote', 'deliveryNote', '0', 'menu');

INSERT INTO `socle`.`menu_solution_company` (`id`, `state`, `companyId`, `menuId`) 
VALUES ('28', '1', '1', '28');

INSERT INTO `socle`.`menu_solution_profils` (`id`, `state`, `profileId`, `menuSolutionCompanyId`) 
VALUES ('28', '1', '1', '28');

CREATE TABLE delivery_note (
    id INT AUTO_INCREMENT PRIMARY KEY,
    provider VARCHAR(255) NOT NULL,
    airport VARCHAR(255) NOT NULL,
    terminal VARCHAR(255) NOT NULL,
    date DATETIME NOT NULL,
    bagsNumber VARCHAR(255) NOT NULL,
    createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Create DeliveryBag table
CREATE TABLE delivery_bag (
    id INT AUTO_INCREMENT PRIMARY KEY,
    ahl VARCHAR(255) NOT NULL,
    passenger VARCHAR(255) NOT NULL,
    address VARCHAR(255) NOT NULL,
    mainPhone VARCHAR(255) NOT NULL,
    secondPhone VARCHAR(255) NOT NULL,
    color VARCHAR(255) NOT NULL,
    route VARCHAR(255) NOT NULL,
    tag VARCHAR(255) NOT NULL,
    ld01 VARCHAR(255) NOT NULL,
    ld02 VARCHAR(255) NOT NULL,
    bagsNumber VARCHAR(255) NOT NULL,
    fileId INT NOT NULL,
    deliveryNotesId INT,
    FOREIGN KEY (deliveryNotesId) REFERENCES delivery_note(id) ON DELETE CASCADE ON UPDATE CASCADE,
    FOREIGN KEY (fileId) REFERENCES files(id) ON DELETE CASCADE ON UPDATE CASCADE
); 