|
|
|
@ -95,14 +95,19 @@ class ModuleService
|
|
|
|
|
$migrationFile = basename($migrationPath); |
|
|
|
|
$migration = str_replace('.php', '', $migrationFile); |
|
|
|
|
if (!$this->migrationExists($migration)) { |
|
|
|
|
$addMigrationRecord = false; |
|
|
|
|
// run migration |
|
|
|
|
require $migrationPath; |
|
|
|
|
$obj = new $migration; |
|
|
|
|
if (method_exists($obj, 'safeUp')) { |
|
|
|
|
$obj->safeUp(); |
|
|
|
|
Yii::$app->moduleManager->appendToMigrationTable($migration); |
|
|
|
|
} elseif (method_exists($obj, 'up')) { |
|
|
|
|
$addMigrationRecord = true; |
|
|
|
|
} |
|
|
|
|
if (method_exists($obj, 'up')) { |
|
|
|
|
$obj->up(); |
|
|
|
|
$addMigrationRecord = true; |
|
|
|
|
} |
|
|
|
|
if ($addMigrationRecord) { |
|
|
|
|
Yii::$app->moduleManager->appendToMigrationTable($migration); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|