copying changes from migrate-to-postgresql...

The same changes than #22 But I needed the branch starting from tag version 2.0.0.