[db] refatctor.