Fix migrations

This recreates all the migrations as though we knew where the tables would end up when we started.