Fix a bug that caused migrations to break on an empty database

Fixes #51