Safer data migrations

Specifically, let sqlalchemy handle type casting, escaping special
chars, etc.

Change-Id: I6ffed964b0dc6e140002664675423b83fdeee166
Auto-detect max SQL migration

Change-Id: I56b1d6ded61ad430929d0275ab384ff464faa53c
Merge "Safer data migrations"
Merge "Auto-detect max SQL migration"