Migrations are broken for PostgreSQL

There were to minor errors while migrating from a fresh PostgresSQL. These two changes fix it.