CREATE TABLE style_info_attachments (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    style_info_id BIGINT UNSIGNED NOT NULL,
    company_id BIGINT UNSIGNED NOT NULL,
    original_name VARCHAR(255) NOT NULL,
    stored_name VARCHAR(255) NOT NULL,
    file_path VARCHAR(500) NOT NULL,
    mime_type VARCHAR(120) NULL,
    extension VARCHAR(20) NULL,
    file_size BIGINT UNSIGNED NOT NULL DEFAULT 0,
    created_by BIGINT UNSIGNED NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    deleted_at TIMESTAMP NULL,
    KEY idx_style_info_attachments_style (style_info_id, deleted_at),
    KEY idx_style_info_attachments_company (company_id),
    CONSTRAINT fk_style_info_attachment_style FOREIGN KEY (style_info_id) REFERENCES style_infos (id),
    CONSTRAINT fk_style_info_attachment_company FOREIGN KEY (company_id) REFERENCES companies (id)
) ENGINE=InnoDB;
