Sync dumping scripts with database changes and improve logging.