websupply / doctrine-rollback
此包最新版本(0.1)没有可用的许可信息。
0.1
2023-02-06 11:15 UTC
Requires
- neos/flow: *
README
通过运行以下命令回滚最新执行的Doctrine迁移
./flow doctrine:rollback
安装
composer require websupply/doctrine-rollback
这个包如何帮助您?
在开发过程中执行了数据库迁移,并想运行down(回滚)方向,命令看起来像这样
./flow doctrine:migrationexecute --version <your-migration-version> --direction down
使用此包,您可以运行
./flow doctrine:rollback
并且最新应用的迁移将以down方向执行
干运行
通过设置--dry-run参数,命令将输出预期要执行的版本,但实际上不会执行它
示例输出
此输出基于运行Flows基本分发的迁移
$ ./flow doctrine:migrate
[HERE COMES ALL THE MIGRATION EXECUTED]
[warning] Migration Neos\Flow\Persistence\Doctrine\Migrations\Version20150611154419 was executed but did not result in any SQL statements.
[notice] finished in 2001.8ms, used 24M memory, 27 migrations executed, 94 sql queries
现在我们已经设置好了
$ ./flow doctrine:rollback --dry-run
DRY RUN: Rollback migration "Neos\Flow\Persistence\Doctrine\Migrations\Version20200908155620"
一个干运行,告诉我们版本20200908155620将被回滚
$ ./flow doctrine:rollback
Migrating down to Neos\Flow\Persistence\Doctrine\Migrations\Version20200908155620
-> ALTER TABLE neos_flow_resourcemanagement_persistentresource ADD md5 VARCHAR(32) NOT NULL
[notice] finished in 151.7ms, used 24M memory, 1 migrations executed, 1 sql queries
执行回滚,回滚预期的迁移
$ ./flow doctrine:migrate
Migrating up to Neos\Flow\Persistence\Doctrine\Migrations\Version20200908155620
-> ALTER TABLE neos_flow_resourcemanagement_persistentresource DROP md5
[notice] finished in 204.9ms, used 22M memory, 1 migrations executed, 1 sql queries
然后再次运行doctrine:migrate命令,以重新应用它(想象一下,你在迁移中做了些修改)
支持和赞助
此包的工作得到丹麦网络公司WebSupply ApS的支持