fix app migrations to work with a blank db

http://manage.dimagi.com/default.asp?151013