Add documentation on how to apply/mark migrations to existing projects #172

This commit is contained in:
Alessandro Briosi
2018-06-21 18:10:36 +02:00
parent bc438974f0
commit e370d2e95a

View File

@ -11,6 +11,11 @@ composer remove dektrium/yii2-user
composer remove dektrium/yii2-rbac composer remove dektrium/yii2-rbac
``` ```
## Install yii2-usuario
```
composer add 2amigos/yii2-usuario
```
## Configuration ## Configuration
Configure the `config/console.php` stuff: Configure the `config/console.php` stuff:
@ -54,6 +59,19 @@ In `config/web.php` remove *module > rbac* configuration and change the *modules
* In your extended model replace the `BaseUser` inheritance from `dektrium\user\models\User` to `Da\User\Model\User` * In your extended model replace the `BaseUser` inheritance from `dektrium\user\models\User` to `Da\User\Model\User`
* If you had controller remapping replace the inheritance from `dektrium\user\controllers\XX` to `Da\User\Controller\XX` * If you had controller remapping replace the inheritance from `dektrium\user\controllers\XX` to `Da\User\Controller\XX`
## Mark migrations as applied in an existing project
If you already have a production project which has all the necessary user tables from dektrium simply run the following commands to
mark some migrations as already applied.
```
./yii migrate/mark "Da\User\Migration\m000000_000005_add_last_login_at"
./yii migrate/to "Da\User\Migration\m000000_000007_enable_password_expiration"
```
The first command will mark the migration as applied, the second will apply missing migrations.
The second command is optiona as a simple ```./yii migrate/up``` would apply all missing migrations anyway.
## Rbac migrations ## Rbac migrations
[yii2-rbac](https://github.com/dektrium/yii2-rbac) had a nice tool which are rbac migrations, which helped writing new permissions and roles. [yii2-rbac](https://github.com/dektrium/yii2-rbac) had a nice tool which are rbac migrations, which helped writing new permissions and roles.