Rewrite db.