Wine was prohibited when there was none of it left in Medina.
لقد حرمت الخمر، وما بالمدينة منها شيء.
Bukhari narrated it in the Book of Drinks (5579), from Hasan bin Sabbah, who said, Muhammad bin Sabiq told us, Malik bin Mughul told us, from Nafi, from Ibn Umar, and he related it.His words, "and there was none of it in Madinah," mean grape wine.He also narrated it (4616) through another route, from Abdul-Aziz bin Umar bin Abdul-Aziz, who said, Nafi told me, from Ibn Umar, who said, "The prohibition of wine was revealed, and at that time there were five kinds of drink in Madinah, none of which was grape wine."