change from pgsql to model