InnoDB requires an index on the referencing column and creates one silently if none exists, which is convenient and produces indexes nobody chose.
ALTER TABLE order_lines
ADD CONSTRAINT fk_order FOREIGN KEY (order_id) REFERENCES orders(id);
-- creates KEY `fk_order` (`order_id`) if nothing covers it.
-- but a composite index starting with order_id satisfies
-- it too, so declaring the index you want FIRST avoids a
-- redundant single-column one:
ADD INDEX idx_order_variant (order_id, variant_id),
ADD CONSTRAINT fk_order FOREIGN KEY (order_id) ...
The auto-created index is a leftmost prefix of any composite you add later, so it becomes redundant write cost that nothing points at. Declaring the composite before the constraint is one line of ordering in a migration and saves an index on every row of a large table.