MINOR: look up tables through DB::tableList()

This commit is contained in:
Andreas Piening 2010-01-27 03:04:37 +00:00
parent f0dbf7f917
commit 10bf22cb00

View File

@ -191,14 +191,16 @@ class UserFormsMigrationTask extends MigrationTask {
* *
*/ */
function findDatabaseTableName($tableName) { function findDatabaseTableName($tableName) {
$table = DB::query("SHOW TABLES LIKE '$tableName'")->value(); $exist = DB::tableList();
if(!$table) { if(!empty($exist)) {
$table = DB::query("SHOW TABLES LIKE '_obsolete_$tableName'")->value(); if(array_search($tableName, $exist) !== false) return $tableName;
$tableName = "_obsolete_$tableName";
if(!$table) echo '<strong>!! Could Not Find '.$tableName; if(array_search($tableName, $exist) !== false) return $tableName;
} }
return $table; echo '<strong>!! Could Not Find '.$tableName;
return;
} }
/** /**
* Create a EditableOption from a whatever type of multi * Create a EditableOption from a whatever type of multi
* form field it is coming from * form field it is coming from