From e370d2e95a5253e14a198cd04db312df8c1ecaef Mon Sep 17 00:00:00 2001 From: Alessandro Briosi Date: Thu, 21 Jun 2018 18:10:36 +0200 Subject: [PATCH] Add documentation on how to apply/mark migrations to existing projects #172 --- .../migration-guide-from-dektrium-tools.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/installation/migration-guide-from-dektrium-tools.md b/docs/installation/migration-guide-from-dektrium-tools.md index 8689567..efea972 100644 --- a/docs/installation/migration-guide-from-dektrium-tools.md +++ b/docs/installation/migration-guide-from-dektrium-tools.md @@ -11,6 +11,11 @@ composer remove dektrium/yii2-user composer remove dektrium/yii2-rbac ``` +## Install yii2-usuario +``` +composer add 2amigos/yii2-usuario +``` + ## Configuration 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` * 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 [yii2-rbac](https://github.com/dektrium/yii2-rbac) had a nice tool which are rbac migrations, which helped writing new permissions and roles.