Skip to content

Commit 0bb1bdf

Browse files
authored
Merge pull request #29 from redthor/v2/readme-updates
V2/readme updates
2 parents 5992f44 + 1440c77 commit 0bb1bdf

File tree

1 file changed

+55
-59
lines changed

1 file changed

+55
-59
lines changed

README.md

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,49 @@
1-
:warning: Forked from [antimattr/mongodb-migrations](https://github.com/antimattr/mongodb-migrations) 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.png?branch=master)](https://travis-ci.org/doesntmattr/mongodb-migrations)
83
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doesntmattr/mongodb-migrations/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doesntmattr/mongodb-migrations/?branch=master)
94
[![Latest Stable Version](https://poser.pugx.org/doesntmattr/mongodb-migrations/v/stable)](https://packagist.org/packages/doesntmattr/mongodb-migrations)
105
[![Total Downloads](https://poser.pugx.org/doesntmattr/mongodb-migrations/downloads)](https://packagist.org/packages/doesntmattr/mongodb-migrations)
116

12-
AntiMattr MongoDB Migrations
13-
============================
7+
# MongoDB Migrations
8+
9+
The MongoDB Migration library provides managed migration support for MongoDB. It was moved to the doesntmattr organisation from [antimattr/mongodb-migrations](https://github.com/antimattr/mongodb-migrations) to continue maintenance (See [issue 16](https://github.com/antimattr/mongodb-migrations/issues/16)).
10+
11+
The original authors are @rcatlin and @matthewfitz
12+
13+
It follows the structure and features provided by [Doctrine Migrations](https://github.com/doctrine/migrations).
1414

15-
The AntiMattr MongoDB Migration library provides managed migration support for MongoDB.
15+
## PHP Version Support
1616

17-
Are you familiar with [Doctrine Migrations](https://github.com/doctrine/migrations)?
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.
1818

19-
This library intentionally parallels the structure and features provided.
19+
## Symfony Bundle
2020

21-
Installation
22-
============
21+
There is a Symfony Bundle you can install to more easily integrate with Symfony. Use the installation instructions there:
2322

24-
Use composer to install
23+
https://github.com/doesntmattr/mongodb-migrations-bundle
24+
25+
## Installation
26+
27+
To install with composer:
2528

2629
```bash
27-
composer install
30+
# For php 5.6
31+
composer require "doesntmattr/mongodb-migrations=^1.0"
32+
33+
# For php 7.1
34+
composer require "doesntmattr/mongodb-migrations=^2.0"
2835
```
2936

30-
Features
31-
========
37+
## Features
3238

33-
Features - Configuration
34-
------------------------
39+
### Configuration
3540

36-
Similar to [Doctrine Migrations](https://github.com/doctrine/migrations), configurations are separated into 2 files
41+
Similar to [Doctrine Migrations](https://github.com/doctrine/migrations), configuration is separated into 2 files:
3742

3843
* Connection configuration (php)
3944
* Migration configuration (xml or yaml)
4045

41-
Example Connection configuration "test\_antimattr\_mongodb.php"
46+
Example connection configuration "test\_antimattr\_mongodb.php":
4247

4348
```php
4449
/**
@@ -56,9 +61,9 @@ return [
5661
];
5762
```
5863

59-
XML or YAML Migration Configurations are supported
64+
XML or YAML migration configuration files are supported.
6065

61-
Example XML "test\_antimattr\_mongodb.xml"
66+
Example XML "test\_antimattr\_mongodb.xml":
6267

6368
```xml
6469
<?xml version="1.0" encoding="UTF-8"?>
@@ -78,7 +83,7 @@ Example XML "test\_antimattr\_mongodb.xml"
7883
</antimattr-migrations>
7984
```
8085

81-
Example YAML "test\_antimattr\_mongodb.yml"
86+
Example YAML "test\_antimattr\_mongodb.yml":
8287

8388
```yaml
8489
---
@@ -90,12 +95,11 @@ migrations_directory: /path/to/migrations/classes/AntiMattrMigrations
9095
migrations_script_directory: /path/to/migrations/script_directory # optional
9196
```
9297
93-
Features - Console Command Support
94-
----------------------------------
98+
### Console Command Support
9599
96-
There is an example Console Application in the demo directory
100+
There is an example Console Application in the `/demo` directory.
97101

98-
This is how to register the commands in your application
102+
This is how you can register commands in your application:
99103

100104
```php
101105
require '../../vendor/autoload.php';
@@ -116,7 +120,7 @@ $application->addCommands([
116120
$application->run();
117121
```
118122

119-
Notice the console is executable
123+
Notice the console is executable:
120124

121125
```bash
122126
> cd demo/ConsoleApplication/
@@ -146,16 +150,14 @@ mongodb
146150
mongodb:migrations:version Manually add and delete migration versions from the version table.
147151
```
148152

149-
Features - Generate a New Migration
150-
-----------------------------------
153+
### Generate a New Migration
151154

152155
```bash
153156
> ./console mongodb:migrations:generate --db-configuration=config/test_antimattr_mongodb.php --configuration=config/test_antimattr_mongodb.yml
154157
Generated new migration class to "Example/Migrations/TestAntiMattr/MongoDB/Version20140822185742.php"
155158
```
156159

157-
Features - Status of Migrations
158-
-------------------------------
160+
### Migrations Status
159161

160162
```bash
161163
> ./console mongodb:migrations:status --db-configuration=config/test_antimattr_mongodb.php --configuration=config/test_antimattr_mongodb.yml
@@ -177,8 +179,7 @@ Features - Status of Migrations
177179
>> New Migrations: 3
178180
```
179181

180-
Features - Migrate all Migrations
181-
---------------------------------
182+
### Migrate all
182183

183184
This is what you will execute during your deployment process.
184185

@@ -226,8 +227,7 @@ Migrating up to 20140822185744 from 0
226227
++ 3 migrations executed
227228
```
228229

229-
Features - Execute a Single Migration
230-
-------------------------------------
230+
### Execute a Single Migration
231231

232232
```bash
233233
./console mongodb:migrations:execute --db-configuration=config/test_antimattr_mongodb.php --configuration=config/test_antimattr_mongodb.yml 20140822185742
@@ -253,25 +253,26 @@ WARNING! You are about to execute a database migration that could result in data
253253
++ migrated (0.02s)
254254
```
255255

256-
Features - Version Up or Down
257-
-----------------------------
256+
If you need to run a migration again, you can use the `--replay` argument.
257+
258+
259+
### Version Up or Down
258260

259261
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.
260262

261-
You can delete
263+
You can delete:
262264

263265
```bash
264266
./console mongodb:migrations:version --db-configuration=config/test_antimattr_mongodb.php --configuration=config/test_antimattr_mongodb.yml --delete 20140822185744
265267
```
266268

267-
You can add
269+
You can add:
268270

269271
```bash
270272
./console mongodb:migrations:version --db-configuration=config/test_antimattr_mongodb.php --configuration=config/test_antimattr_mongodb.yml --add 20140822185744
271273
```
272274

273-
Features - Analyze Migrations
274-
-----------------------------
275+
### Analyze Migrations
275276

276277
Identify the collections you want to analyze. Statistics will be captured before and after the migration is run.
277278

@@ -287,10 +288,9 @@ class Version20140822185742 extends AbstractMigration
287288
}
288289
```
289290

290-
Features - Execute JS Scripts
291-
-----------------------------
291+
### Execute JS Scripts
292292

293-
First identify the directory for scripts in your Migration configuration
293+
First identify the directory for scripts in your Migration Configuration:
294294

295295
```yaml
296296
---
@@ -302,7 +302,7 @@ migrations_directory: /path/to/migrations/classes/AntiMattrMigrations
302302
migrations_script_directory: /path/to/migrations/script_directory # optional
303303
```
304304

305-
Then execute the scripts via AbstractMigration::executeScripts
305+
Then execute the scripts via `AbstractMigration::executeScript()`:
306306

307307
```php
308308
class Version20140822185743 extends AbstractMigration
@@ -313,34 +313,30 @@ class Version20140822185743 extends AbstractMigration
313313
}
314314
```
315315

316-
Pull Requests
317-
=============
316+
## Contributing
318317

319-
Pull Requests - PSR Standards
320-
-----------------------------
318+
### PSR Standards
321319

322-
Please use the pre-commit hook to run the fix all code to PSR standards
320+
There is a git pre-commit hook that will fix all your contributed code to PSR standards.
323321

324-
Install once with
322+
You can install it with:
325323

326324
```bash
327325
./bin/install.sh
328326
Copying /antimattr-mongodb-migrations/bin/pre-commit.sh -> /antimattr-mongodb-migrations/bin/../.git/hooks/pre-commit
329327
```
330328

331-
Pull Requests - Testing
332-
-----------------------
329+
### Testing
333330

334-
Please make sure tests pass
331+
Tests should pass:
335332

336333
```bash
337-
$ vendor/bin/phpunit tests
334+
$ ./vendor/bin/phpunit
338335
```
339336

340-
Pull Requests - Code Sniffer and Fixer
341-
--------------------------------------
337+
### Code Sniffer and Fixer
342338

343-
Don't have the pre-commit hook running, please make sure to run the fixer/sniffer manually
339+
If you didn't install the git pre-commit hook then ensure you run the fixer/sniffer manually:
344340

345341
```bash
346342
$ vendor/bin/php-cs-fixer fix src/

0 commit comments

Comments
 (0)