gheb/data-migrations-bundle

该包已被废弃且不再维护。没有建议的替代包。

在数据结构旁边迁移数据。

资助包维护!
gregoirehebert

安装次数: 4,620

依赖项: 0

建议者: 0

安全: 0

星标: 4

关注者: 2

分支: 1

公开问题: 0

类型:symfony-bundle

1.4.3 2019-11-23 12:56 UTC

This package is auto-updated.

Last update: 2021-01-18 12:37:22 UTC


README

❗ ❗

此Bundle曾经很有用,但自从Doctrine Migrations Bundle 2.2以来就不再必要了。请优先使用 doctrine migrations bundle 的多个目录 :)

https://symfony.com.cn/doc/2.2/bundles/DoctrineMigrationsBundle/index.html#configuration

我不会再维护此Bundle了 :) 感谢大家!

DataMigrationsBundle

License: MIT Build Status

此Bundle是 Doctrine2 Migrations Bundle 在 Symfony 应用程序中缺失的部分。数据迁移帮助您对数据更改进行版本控制,并以可预测的方式在运行应用程序的每个服务器上应用。

安装

$ composer require gheb/data-migrations-bundle

库位于 vendor/gheb/DataMigrationsBundle。最后,请确保在 AppKernel.php 中启用此Bundle,方法是在其中包含以下内容

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        //...
        new Gheb\DataMigrationsBundle\DataMigrationsBundle(),
    );
}

配置

您可以在 config.yml 中配置路径、命名空间、table_name、name、organize_migrations 和 custom_template。以下示例是默认值。

# app/config/config.yml
data_migrations:
    dir_name: "%kernel.root_dir%/DataMigrations"
    namespace: "Application\\Migrations"
    table_name: "data_migration_versions"
    name: Application Data Migrations
    organize_migrations: false # Possible values are: "BY_YEAR", "BY_YEAR_AND_MONTH", false
    custom_template: ~ # Path to your custom migrations template

使用方法

注意事项

If your application is based on Symfony 3, replace `php app/console` by `php bin/console` before executing any of the console commands included
in this article.

所有迁移功能都包含在几个控制台命令中

 gheb:data-migrations:execute             [execute] Execute a single migration version up or down manually.
 gheb:data-migrations:generate            [generate] Generate a blank migration class.
 gheb:data-migrations:latest              [latest] Outputs the latest version number
 gheb:data-migrations:migrate             [migrate] Execute a migration to a specified version or the latest available version.
 gheb:data-migrations:status              [status] View the status of a set of migrations.
 gheb:data-migrations:version             [version] Manually add and delete migration versions from the version table.

文档

此Bundle基于 doctrine migrations bundle。如需更多信息,请参阅 原始Bundle文档

运行测试 & cs 检查

$ ./vendor/bin/phpunit --bootstrap vendor/autoload.php --testdox tests $ ./vendor/bin/php-cs-fixer fix --config .php_cs.dist --verbose --dry-run src