Pepending table name to index generation to avoid name clashes

Finally, all tests using a Sqlite database pass
This commit is contained in:
José Lorenzo Rodríguez 2010-12-03 15:25:04 -04:30
parent e167271568
commit 66d0986cd4
2 changed files with 4 additions and 3 deletions

View file

@ -443,7 +443,8 @@ class DboSqlite extends DboSource {
} else { } else {
$value['column'] = $this->name($value['column']); $value['column'] = $this->name($value['column']);
} }
$out .= "INDEX {$name} ON {$table}({$value['column']});"; $t = trim($table, '"');
$out .= "INDEX {$t}_{$name} ON {$table}({$value['column']});";
$join[] = $out; $join[] = $out;
} }
return $join; return $join;

View file

@ -37,14 +37,14 @@ class AllDatabaseTest extends PHPUnit_Framework_TestSuite {
$suite = new PHPUnit_Framework_TestSuite('Datasources, Schema and DbAcl tests'); $suite = new PHPUnit_Framework_TestSuite('Datasources, Schema and DbAcl tests');
$path = CORE_TEST_CASES . DS . 'libs' . DS . 'model' . DS; $path = CORE_TEST_CASES . DS . 'libs' . DS . 'model' . DS;
$tasks = array( $tasks = array(
'db_acl', 'db_acl',
'cake_schema', 'cake_schema',
'connection_manager', 'connection_manager',
'datasources' . DS . 'dbo_source', 'datasources' . DS . 'dbo_source',
'datasources' . DS . 'dbo' . DS . 'dbo_mysql', 'datasources' . DS . 'dbo' . DS . 'dbo_mysql',
'datasources' . DS . 'dbo' . DS . 'dbo_postgres' 'datasources' . DS . 'dbo' . DS . 'dbo_postgres',
'datasources' . DS . 'dbo' . DS . 'dbo_sqlite'
); );
foreach ($tasks as $task) { foreach ($tasks as $task) {
$suite->addTestFile($path . $task . '.test.php'); $suite->addTestFile($path . $task . '.test.php');