CREATE TABLE IF NOT EXISTS shoppro_delivery_method_mappings (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    integration_id INT UNSIGNED NOT NULL,
    order_delivery_method VARCHAR(200) NOT NULL,
    carrier VARCHAR(50) NOT NULL DEFAULT 'allegro',
    allegro_delivery_method_id VARCHAR(128) NOT NULL,
    allegro_credentials_id VARCHAR(128) NULL,
    allegro_carrier_id VARCHAR(128) NULL,
    allegro_service_name VARCHAR(255) NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    UNIQUE KEY shoppro_dm_mapping_unique (integration_id, order_delivery_method),
    KEY shoppro_dm_mapping_integration_idx (integration_id),
    CONSTRAINT shoppro_dm_mapping_integration_fk
        FOREIGN KEY (integration_id) REFERENCES integrations(id)
        ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
