extract common rake db task