Perform database migration snake walk test correctly

Fixes bug 1204940

The database migration snake walk test would not properly perform downgrades
leaving that part of the test non-functional.

Also, if downgrade was True, the test wouldn't downgrade all of the way to
the first migration because of a fence post error.

Change-Id: I44873fc9bb0b159c941a90ce19b74e1afba8b6a8
Merge "Perform database migration snake walk test correctly"