mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-16 15:21:13 +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();
|
$columns = $this->db->createCommand($sql)->queryAll();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$previous = $e->getPrevious();
|
$previous = $e->getPrevious();
|
||||||
if ($previous instanceof \PDOException && $previous->getCode() == '42S02') {
|
if ($previous instanceof \PDOException && strpos($previous->getMessage(), 'SQLSTATE[42S02') !== false) {
|
||||||
// index does not exist
|
// index does not exist
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ class Schema extends \yii\db\Schema
|
|||||||
$columns = $this->db->createCommand($sql)->queryAll();
|
$columns = $this->db->createCommand($sql)->queryAll();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$previous = $e->getPrevious();
|
$previous = $e->getPrevious();
|
||||||
if ($previous instanceof \PDOException && $previous->getCode() == '42S02') {
|
if ($previous instanceof \PDOException && strpos($previous->getMessage(), 'SQLSTATE[42S02') !== false) {
|
||||||
// table does not exist
|
// table does not exist
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user