| Conditions | 4 |
| Paths | 5 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function up() |
||
| 16 | { |
||
| 17 | $authManager = \Yii::$app->getAuthManager(); |
||
| 18 | |||
| 19 | if (!$authManager) { |
||
| 20 | throw new InvalidConfigException('You should configure "authManager" component to use database before executing this migration.'); |
||
| 21 | } |
||
| 22 | |||
| 23 | if (!$authManager->db->schema->getTableSchema($authManager->assignmentTable)) { |
||
| 24 | \Yii::$app->runAction('migrate', ['migrationPath' => '@yii/rbac/migrations/', 'interactive' => false]); |
||
| 25 | } |
||
| 26 | |||
| 27 | if (!$authManager->db->createCommand('SELECT * FROM '.$authManager->assignmentTable)->queryOne()) { |
||
| 28 | \Yii::$app->runAction('rbac/init', ['interactive' => false]); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 40 |