change db to be trait