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