Very-high-energy γ-ray observations of novae and dwarf novae with the MAGIC telescopes