change database and model SQL functions