mi/mongodb-migrations

此包已被弃用且不再维护。未建议替代包。

用于在mongodb中向前和向后迁移的库。

v2.0.0-beta2 2016-04-27 08:03 UTC

This package is not auto-updated.

Last update: 2020-02-07 09:31:27 UTC


README

Build Status Latest Stable Version Latest Unstable Version Total Downloads License

概览

...

安装

Composer

针对PHP 7及以上版本的新mongoDB扩展

composer require mi/mongodb-migrations

针对其他PHP版本

composer require mi/mongodb-migrations ^1.0.0@beta

Puli绑定

MY_BUNDLE_ALIAS = 您的包别名(例如 my_awesome_bundle

puli bind --class Mi\\MongoDb\\Migration\\DependencyInjection\\MigrationPlugin Matthias\\BundlePlugins\\BundlePlugin --param bundle-alias=<MY_BUNDLE_ALIAS>
puli bind /mi/mongodb-migrations/*.xml mi/service
puli build

配置

my_awesome_bundle:
    ...
    
    migration:
        path: '/path/to/version/class/directory'                            // path where versions will be constructed
        xml_path: '/path/to/version/service-definition/file'                // service-definitions where versions will be defined
        namespace: "namespace\\of\\generated\\versions"                     // namespace versions will be constructed with
        migration_collection: 'migration.collection.service.definition.id'  // need to be from type MongoCollection

刷新自动加载器

将命名空间 namespace\\of\\generated\\versions 添加到自动加载器中并执行

composer dump-autoload

用法

创建版本

console mi:mongo-db:migration:generate

执行迁移

console mi:mongo-db:migration:migrate

贡献

  1. Fork它
  2. 创建您的功能分支(git checkout -b my-new-feature
  3. 提交您的更改(git commit -am 'Add some feature'
  4. 推送到分支(git push origin my-new-feature
  5. 创建新的Pull Request

许可证

此库采用MIT许可证