Fix bug when migrating database on psql