Rob*_*ita 5 sql migration doctrine
I have been researching a way to get the SQL statements that are built by a generated Migration file. These extend Doctrine_Migration_Base. Essentially I would like to save the SQL as change scripts.
执行路径将我引导到Doctrine_Export,它具有构建SQL语句并执行它们的方法.我发现没有办法要求他们.Doctrine_Export中的导出方法仅在Doctrine_Record模型上运行,而不在迁移脚本上运行.
从命令行'./doctrine migrate version#'开始:
有没有人解决过这个问题?我真的不想改变Doctrine基础文件.任何帮助是极大的赞赏.
考虑到 Rob Farley 的建议,我修改了:
当调用执行方法时,将检查可选参数“dryRun”。如果为 true,则创建“Doctrine_Connection_Profiler”实例。然后将“dryRun”值传递给“Doctrine_Core::migrate”方法。“dryRun”值为 true 允许在执行完 SQL 语句后回滚更改。当该方法返回时,分析器将被解析,并且不包含“migration_version”的非空 SQL 语句将被保存并显示到终端。