merge from yiisoft/yii2

This commit is contained in:
cuileon
2018-11-14 11:57:32 +08:00
parent 47df8a8cc0
commit 489dd119a5
426 changed files with 18465 additions and 4215 deletions

View File

@@ -310,8 +310,17 @@ class MigrateController extends BaseMigrateController
// Then drop the tables:
foreach ($schemas as $schema) {
$db->createCommand()->dropTable($schema->name)->execute();
$this->stdout("Table {$schema->name} dropped.\n");
try {
$db->createCommand()->dropTable($schema->name)->execute();
$this->stdout("Table {$schema->name} dropped.\n");
} catch (\Exception $e) {
if (strpos($e->getMessage(), 'DROP VIEW to delete view') !== false) {
$db->createCommand()->dropView($schema->name)->execute();
$this->stdout("View {$schema->name} dropped.\n");
} else {
$this->stdout("Cannot drop {$schema->name} Table .\n");
}
}
}
}