migrate old data into sql table