schema_migration: Fix off-by-1 error in downgrade
allow schema-migration to be missing

When it is missing, the rest of the code assumes a schema version
to be of 0. Otherwise we would need to add schema-migration 0
to all proposals, which requires a time machine.
schema_migration: fix case where schema-migration is missing in template
Merge pull request #702 from vuntz/migration-fixes

Fixes in the schema migration code