fix table scan for pg migrations