public function getLastBatchNumber() {
        $result = $this->getEntities()->createQueryBuilder()
            ->select('o, MAX(o.batch) as max_batch')
            ->from('Mitch\LaravelDoctrine\Migrations\Migration', 'o')
            ->getQuery()->getResult()[0]['max_batch'];

        return $result ?: 0;
    }