Symfony2 doctrine:schema:update 极慢

Symfony2 doctrine:schema:update extremely slow

所以在我的工作中,我作为软件开发人员从事 Symfony2 项目。我们遇到了 schema:update 的性能问题,--dump-sql 大约需要 10 分钟,--force 需要 1 小时(是的,1 小时,你没有看错)完全的。 我们的开发环境可能不是最好的,但仍然如此。 代码在我的电脑上,在 Win7 64 上(显然本地 PHP 5.6 / apache 2.4) 数据库是远程的,在其他地方的数据中心,它是 Oracle 12c 我在网上到处都看过,每个有 "slow" schema:update 问题的人都在谈论大约 30 秒,所以,甚至还没有结束 ^^

有没有人遇到过这种疯狂的延迟?

再次感谢您,我很乐意提供任何信息。

干杯!

开发时最好从新的数据库和装置开始,因此请删除并重新创建您的数据库:

php app/console doctrine:database:drop
php app/console doctrine:database:create --if-not-exists --env=dev
php app/console doctrine:schema:create --env=dev

[编辑 2020/03]

我现在使用 Makefile 来完成所有这些开发任务:

load-fixtures: ## Build the db, control the schema validity, load fixtures and check the migration status
    $(SYMFONY) doctrine:cache:clear-metadata
    $(SYMFONY) doctrine:database:create --if-not-exists
    $(SYMFONY) doctrine:schema:drop --force
    $(SYMFONY) doctrine:schema:create
    $(SYMFONY) doctrine:schema:validate
    $(SYMFONY) doctrine:fixtures:load -n
    $(SYMFONY) doctrine:schema:validate

您可以找到 the full version for Symfony 5 here.

正如 tftd 所说,这就是连接。他们迁移了一些东西,现在我们达到了 15 分钟的最高点。还是很多,但至少好多了。