Skip to content

Commit f16035b

Browse files
committed
Update README stating PHP version support and various other small changes
1 parent cf7af46 commit f16035b

File tree

1 file changed

+35
-64
lines changed

1 file changed

+35
-64
lines changed

README.md

Lines changed: 35 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,34 @@
1-
:warning: Forked from [antimattr/mongodb-migrations-bundle](https://github.com/antimattr/mongodb-migrations-bundle) for contributors as the original project isn't being maintained. See [issue 16](https://github.com/antimattr/mongodb-migrations/issues/16)
2-
3-
The original authors did an awesome job of making a library that has been really
4-
really useful AND stable. Thank you @rcatlin and @matthewfitz !
5-
61
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
72
[![Build Status](https://travis-ci.org/doesntmattr/mongodb-migrations-bundle.svg?branch=master)](https://travis-ci.org/doesntmattr/mongodb-migrations-bundle)
83
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doesntmattr/mongodb-migrations-bundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doesntmattr/mongodb-migrations-bundle/?branch=master)
94
[![Latest Stable Version](https://poser.pugx.org/doesntmattr/mongodb-migrations-bundle/v/stable)](https://packagist.org/packages/doesntmattr/mongodb-migrations-bundle)
105
[![Total Downloads](https://poser.pugx.org/doesntmattr/mongodb-migrations-bundle/downloads)](https://packagist.org/packages/doesntmattr/mongodb-migrations-bundle)
116

12-
MongoDBMigrationsBundle
13-
========================
7+
# MongoDB Migrations Bundle
148

15-
This bundle integrates the [AntiMattr MongoDB Migrations library](https://github.com/doesntmattr/mongodb-migrations) into Symfony so that you can safely and quickly manage MongoDB migrations.
9+
This bundle integrates the [MongoDB Migrations](https://github.com/doesntmattr/mongodb-migrations) library into Symfony to get you set up more quickly.
1610

17-
Installation
18-
============
11+
It was moved to the doesntmattr organisation from [antimattr/mongodb-migrations-bundle](https://github.com/antimattr/mongodb-migrations-bundle) to continue maintenance (See [issue 16](https://github.com/antimattr/mongodb-migrations/issues/16)).
1912

20-
Add the following to your composer.json file:
13+
The original authors are @rcatlin and @matthewfitz
2114

22-
```json
23-
{
24-
"require": {
25-
"doesntmattr/mongodb-migrations-bundle": "^1.0"
26-
}
27-
}
28-
```
15+
## PHP Version Support
16+
17+
If you require php 5.6 support use version `^1.0`. Version `^2.0` requires at least php 7.1. The `1.x` releases will only receive bug fixes.
18+
19+
## Installation
2920

30-
Install the libraries by running:
21+
Install with composer:
3122

3223
```bash
33-
composer install
34-
```
24+
# For php 5.6
25+
composer require "doesntmattr/mongodb-migrations-bundle=^1.0"
3526

36-
If everything worked, the MonogDBMigrationsBundle can now be found at vendor/doesntmattr/mongodb-migrations-bundle.
27+
# For php 7.1
28+
composer require "doesntmattr/mongodb-migrations-bundle=^2.0"
29+
```
3730

38-
Finally, be sure to enable the bundle in AppKernel.php by including the following:
31+
then enable the bundle in `AppKernel.php` by including the following:
3932

4033
```php
4134
// app/AppKernel.php
@@ -48,10 +41,9 @@ public function registerBundles()
4841
}
4942
```
5043

51-
Configuration
52-
=============
44+
## Configuration
5345

54-
Add following configuration lines to config.yml file.
46+
Add following configuration lines to `config.yml` file.
5547

5648
```yaml
5749
# app/config/config.yml
@@ -61,15 +53,14 @@ mongo_db_migrations:
6153
dir_name: "%kernel.root_dir%/../src/OpenSky/Bundle/MainBundle/Migrations/MongoDB"
6254
script_dir_name: "%kernel.root_dir%/scripts"
6355
name: "OpenSky DEVO MongoDB Migrations"
64-
namespace: "OpenSky\Bundle\MainBundle\Migrations\MongoDB"
56+
namespace: "OpenSky\\Bundle\\MainBundle\\MigrationsMongoDB"
6557
```
6658
67-
Container Aware Migrations
68-
==========================
59+
## Container Aware Migrations
6960
70-
In some cases you might need access to the container to ensure the proper update of your data structure. This could be necessary to update relations with some specific logic or to create new entities.
61+
In some cases you might want to access some services you have defined in the container. For example you may want to use a Factory to create new entities in the structure you need.
7162
72-
Therefore you can just implement the ContainerAwareInterface with its needed methods to get full access to the container.
63+
To get access to the container simply implement the ContainerAwareInterface including the required method `setContainer()`:
7364

7465
```php
7566
// ...
@@ -98,51 +89,31 @@ class Version20130326212938 extends AbstractMigration implements ContainerAwareI
9889
}
9990
```
10091

101-
MongoDB Cursor Timeouts
102-
=======================
92+
## MongoDB Cursor Timeouts
10393

104-
In some cases you may need the Cursor timeout to be extended. You can of course do this on a per migration basis, or you can do this for all migrations by extending the base migration and adding to the constructor.
10594

106-
```php
107-
// ...
108-
use AntiMattr\MongoDB\Migrations\AbstractMigration as BaseMigration;
109-
use AntiMattr\MongoDB\Migrations\Version;
110-
use MongoCursor;
95+
In some cases you may need the Cursor timeout to be extended. If so, add the MongoDB option `['socketTimeoutMs' => -1]` to your update method.
11196

112-
abstract class AbstractMigration extends BaseMigration
113-
{
114-
/**
115-
* @var AntiMattr\MongoDB\Migrations\Version
116-
*/
117-
public function __construct(Version $version)
118-
{
119-
parent::__construct($version);
120-
MongoCursor::$timeout = -1;
121-
}
122-
}
123-
```
12497

125-
Features
126-
========
98+
## Features
12799

128-
For a full list of available features, see the README.md in the underlying library
100+
For a full list of available features, see the README.md in the MongoDB Migrations library:
129101

130102
https://github.com/doesntmattr/mongodb-migrations/blob/master/README.md
131103

132104
Differences from the underlying library are limited to the Console commands, namely database configurations are handled by Symfony's Dependency injection container, so you don't pass them as command line args.
133105

134106
Examples of the Command Line args with the difference below:
135107

136-
Features - Generate a New Migration
137-
-----------------------------------
108+
### Generate a New Migration
109+
138110

139111
```bash
140112
> ./console mongodb:migrations:generate
141113
Generated new migration class to "Example/Migrations/TestAntiMattr/MongoDB/Version20140822185742.php"
142114
```
143115

144-
Features - Status of Migrations
145-
-------------------------------
116+
### Status of Migrations
146117

147118
```bash
148119
> ./console mongodb:migrations:status
@@ -164,8 +135,7 @@ Features - Status of Migrations
164135
>> New Migrations: 3
165136
```
166137

167-
Features - Migrate all Migrations
168-
---------------------------------
138+
### Migrate all Migrations
169139

170140
This is what you will execute during your deployment process.
171141

@@ -213,8 +183,7 @@ Migrating up to 20140822185744 from 0
213183
++ 3 migrations executed
214184
```
215185

216-
Features - Execute a Single Migration
217-
-------------------------------------
186+
### Execute a Single Migration
218187

219188
```bash
220189
./console mongodb:migrations:execute 20140822185742
@@ -240,8 +209,10 @@ WARNING! You are about to execute a database migration that could result in data
240209
++ migrated (0.02s)
241210
```
242211

243-
Features - Version Up or Down
244-
-----------------------------
212+
Use `--replay` if you need to re-run an executed migration.
213+
214+
215+
### Version Up or Down
245216

246217
Is your migration history out of sync for some reason? You can manually add or remove a record from the history without running the underlying migration.
247218

0 commit comments

Comments
 (0)