public function update(): Schema
    {
        if ('cli' !== PHP_SAPI) {
            throw new \RuntimeException('This should only be called from the command line');
        }
        $metadata        = $this->getAllMetaData();
        $schemaUpdateSql = $this->schemaTool->getUpdateSchemaSql($metadata);
        if (0 !== count($schemaUpdateSql)) {
            $connection = $this->entityManager->getConnection();
            foreach ($schemaUpdateSql as $sql) {
                try {
                    $connection->executeQuery($sql);
                } catch (DBALException $e) {
                    throw new DoctrineStaticMetaException(
                        "exception running update sql:\n$sql\n",
                        $e->getCode(),
                        $e
                    );
                }
            }
        }
        $this->generateProxies();

        return $this;
    }