add migrations and make them work on blank db, and more tests