Gold mining made Ballarat a rich town, and it was made a city in 1871. The railway came to the town with the opening of the Geelong-Ballarat line in 1862, and a direct line to Melbourne finished in December 1889.