saelker/migrations-bundle

Symfony Bundle,用于处理多个包之间的迁移

安装次数: 9,302

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 1

开放问题: 0

类型:symfony-bundle

v2.1.1 2023-08-22 06:39 UTC

README

从1.1.x更新到1.2.x

在更新到1.2.x之前,请向迁移表中添加类型为integersequence

步骤 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