Added migrate script for the old database.
Fixed migrations.