mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix Truncate Error Issue when using views in a Unittest.
When using a view in a SilverStripe project, whenever the tear down scripts for the Unittests are run the following error occurs: Couldn't run query: TRUNCATE "ActivityPoints_view" Table 'ss_tmpdb2391727.ActivityPoints_view' doesn't exist This was due to the MySQLSchemaManager::tableList() function assuming that all records in the TABLES were actual tables containing data. This small tweak fixes the issue by modifying the SQL to filter out views from the list before truncating.
This commit is contained in:
parent
69451790d6
commit
b04a1ab41c
@ -336,7 +336,7 @@ class MySQLSchemaManager extends DBSchemaManager {
|
||||
|
||||
public function tableList() {
|
||||
$tables = array();
|
||||
foreach ($this->query("SHOW TABLES") as $record) {
|
||||
foreach ($this->query("SHOW FULL TABLES WHERE Table_Type != 'VIEW'") as $record) {
|
||||
$table = reset($record);
|
||||
$tables[strtolower($table)] = $table;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user