saelker / migrations-bundle
Symfony Bundle,用于处理多个包之间的迁移
v2.1.1
2023-08-22 06:39 UTC
Requires
- php: >=8.1
- doctrine/dbal: ~2.5
- symfony/console: ~2.3|~3.0|~4.0|~5.0|~6.0
- symfony/framework-bundle: ~3.0|~4.0|~5.0|~6.0
Requires (Dev)
README
从1.1.x更新到1.2.x
在更新到1.2.x之前,请向迁移表中添加类型为integer的sequence列
步骤 1: 使用Composer安装
composer reqire saelker/migrations-bundle
步骤 2: 添加到您的应用Kernel
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Saelker\MigrationsBundle\SaelkerMigrationsBundle(), ); }
步骤 3.1: 通过配置添加目录
# Saelker Migrations Directories saelker_migrations: directories: - '%kernel.project_dir%/src/AppBundle/Migrations' ...
步骤 3.2: 通过CompilerPass添加目录
class SaelkerMigrationsBundle extends Bundle { public function build(ContainerBuilder $container) { parent::build($container); $container->addCompilerPass(new MigrationsCompilerPass(__DIR__ . "/Migrations")); } }
步骤 4: 运行第一次迁移
bin/console saelker:migrations:migrate
步骤 5: 生成新的迁移
bin/console saelker:migrations:generate
步骤 6: 修改保存路径的深度
# Saelker Migrations Directories saelker_migrations: clean_depth: 3 directory_separator: '/' use_camel_case: false ignore_errors: false