|
|
@ -106,15 +106,14 @@ class QueryBuilder extends \yii\db\QueryBuilder |
|
|
|
public function checkIntegrity($check = true, $schema = '', $table = '') |
|
|
|
public function checkIntegrity($check = true, $schema = '', $table = '') |
|
|
|
{ |
|
|
|
{ |
|
|
|
$enable = $check ? 'ENABLE' : 'DISABLE'; |
|
|
|
$enable = $check ? 'ENABLE' : 'DISABLE'; |
|
|
|
|
|
|
|
$schema = $schema ? $schema : $this->db->schema->defaultSchema; |
|
|
|
$tableNames = $table ? [$table] : $this->db->schema->findTableNames($schema); |
|
|
|
$tableNames = $table ? [$table] : $this->db->schema->findTableNames($schema); |
|
|
|
$command = ''; |
|
|
|
$command = ''; |
|
|
|
|
|
|
|
|
|
|
|
foreach($tableNames as $tableName) |
|
|
|
foreach($tableNames as $tableName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$tableName='"'.$tableName.'"'; |
|
|
|
$tableName='"'.$schema.'"."'.$tableName.'"'; |
|
|
|
if(strpos($tableName,'.')!==false) |
|
|
|
$command .= "ALTER TABLE $tableName $enable TRIGGER ALL; "; |
|
|
|
$tableName=str_replace('.','"."',$tableName); |
|
|
|
|
|
|
|
$command .= "ALTER TABLE $tableName $enable TRIGGER ALL; "; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#enable to have ability to alter several tables |
|
|
|
#enable to have ability to alter several tables |
|
|
|