mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 14:28:27 +08:00
more robust check for table not exists
should work on HHVM too
This commit is contained in:
@ -453,7 +453,7 @@ class Schema extends Object
|
||||
$columns = $this->db->createCommand($sql)->queryAll();
|
||||
} catch (\Exception $e) {
|
||||
$previous = $e->getPrevious();
|
||||
if ($previous instanceof \PDOException && $previous->getCode() == '42S02') {
|
||||
if ($previous instanceof \PDOException && strpos($previous->getMessage(), 'SQLSTATE[42S02') !== false) {
|
||||
// index does not exist
|
||||
return false;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ class Schema extends \yii\db\Schema
|
||||
$columns = $this->db->createCommand($sql)->queryAll();
|
||||
} catch (\Exception $e) {
|
||||
$previous = $e->getPrevious();
|
||||
if ($previous instanceof \PDOException && $previous->getCode() == '42S02') {
|
||||
if ($previous instanceof \PDOException && strpos($previous->getMessage(), 'SQLSTATE[42S02') !== false) {
|
||||
// table does not exist
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user