Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
5f852465
Commit
5f852465
authored
Jun 19, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs about mongodb migration usage adjusted
parent
0da628ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
6 deletions
+40
-6
CHANGELOG.md
extensions/mongodb/CHANGELOG.md
+1
-1
README.md
extensions/mongodb/README.md
+36
-2
MigrateController.php
extensions/mongodb/console/controllers/MigrateController.php
+3
-3
No files found.
extensions/mongodb/CHANGELOG.md
View file @
5f852465
...
...
@@ -7,7 +7,7 @@ Yii Framework 2 mongodb extension Change Log
-
Bug #3385: Fixed "The 'connected' property is deprecated" (samdark)
-
Enh #3520: Added
`unlinkAll()`
-method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
-
Enh #3778: Gii generator for Active Record model added (klimov-paul)
-
Enh: Migration support added (klimov-paul)
-
Enh
#3947
: Migration support added (klimov-paul)
2.0.0-beta April 13, 2014
...
...
extensions/mongodb/README.md
View file @
5f852465
...
...
@@ -285,4 +285,38 @@ return [
```
> Note: since MongoDB is schemaless, there is not much information, which generated code may base on. So generated code
is very basic and definitely requires adjustments.
\ No newline at end of file
is very basic and definitely requires adjustments.
Using Migrations
----------------
MongoDB is schemaless and will create any missing collection on the first demand. However there are many cases, when
you may need applying persistent changes to the MongoDB database. For example: you may need to create a collection with
some specific options or create indexes.
MongoDB migrations are managed via
[
[yii\mongodb\console\controllers\MigrateController
]
], which is an analog of regular
[
[\yii\console\controllers\MigrateController
]
].
In order to enable this command you should adjust the configuration of your console application:
```
php
return
[
// ...
'controllerMap'
=>
[
'mongodb-migrate'
=>
'yii\mongodb\console\controllers\MigrateController'
],
];
```
Below are some common usages of this command:
```
# creates a new migration named 'create_user_collection'
yii mongodb-migrate/create create_user_collection
# applies ALL new migrations
yii mongodb-migrate
# reverts the last applied migration
yii mongodb-migrate/down
```
\ No newline at end of file
extensions/mongodb/console/controllers/MigrateController.php
View file @
5f852465
...
...
@@ -17,7 +17,7 @@ use yii\helpers\ArrayHelper;
/**
* Manages application MongoDB migrations.
*
* This is an analog of [[\yii\console\controllers
|
MigrateController]] for MongoDB.
* This is an analog of [[\yii\console\controllers
\
MigrateController]] for MongoDB.
*
* This command provides support for tracking the migration history, upgrading
* or downloading with migrations, and creating new migration skeletons.
...
...
@@ -40,8 +40,8 @@ use yii\helpers\ArrayHelper;
* Below are some common usages of this command:
*
* ~~~
* # creates a new migration named 'create_user_
table
'
* yii mongodb-migrate/create create_user_
table
* # creates a new migration named 'create_user_
collection
'
* yii mongodb-migrate/create create_user_
collection
*
* # applies ALL new migrations
* yii mongodb-migrate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment