You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-64Lines changed: 35 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff 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 !
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.
16
10
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)).
19
12
20
-
Add the following to your composer.json file:
13
+
The original authors are @rcatlin and @matthewfitz
21
14
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.
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.
71
62
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()`:
73
64
74
65
```php
75
66
// ...
@@ -98,51 +89,31 @@ class Version20130326212938 extends AbstractMigration implements ContainerAwareI
98
89
}
99
90
```
100
91
101
-
MongoDB Cursor Timeouts
102
-
=======================
92
+
## MongoDB Cursor Timeouts
103
93
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.
105
94
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.
111
96
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
-
```
124
97
125
-
Features
126
-
========
98
+
## Features
127
99
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:
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.
133
105
134
106
Examples of the Command Line args with the difference below:
135
107
136
-
Features - Generate a New Migration
137
-
-----------------------------------
108
+
### Generate a New Migration
109
+
138
110
139
111
```bash
140
112
> ./console mongodb:migrations:generate
141
113
Generated new migration class to "Example/Migrations/TestAntiMattr/MongoDB/Version20140822185742.php"
142
114
```
143
115
144
-
Features - Status of Migrations
145
-
-------------------------------
116
+
### Status of Migrations
146
117
147
118
```bash
148
119
> ./console mongodb:migrations:status
@@ -164,8 +135,7 @@ Features - Status of Migrations
164
135
>> New Migrations: 3
165
136
```
166
137
167
-
Features - Migrate all Migrations
168
-
---------------------------------
138
+
### Migrate all Migrations
169
139
170
140
This is what you will execute during your deployment process.
171
141
@@ -213,8 +183,7 @@ Migrating up to 20140822185744 from 0
@@ -240,8 +209,10 @@ WARNING! You are about to execute a database migration that could result in data
240
209
++ migrated (0.02s)
241
210
```
242
211
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
245
216
246
217
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.
0 commit comments