By the end of the Song dynasty, the center of trading had moved downstream of the Wusong River to Shanghai. It was upgraded in status from a village to a market town in 1074, and in 1172, a second sea wall was built to stabilize the ocean coastline, supplementing an earlier dike. From the Yuan dynasty in 1292 until Shanghai officially became a municipality in 1927, central Shanghai was administered as a county under Songjiang Prefecture, which had its seat in the present-day Songjiang District.