Fix db migration and RESTful resource arrangement