MINOR: unique indexes on versioned tables now changed to 'index'

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@114134 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-11-24 06:23:49 +00:00
parent f1bf0d0fc4
commit 196cabb2f0

View File

@ -249,6 +249,13 @@ class Versioned extends DataObjectDecorator {
// Create tables for other stages // Create tables for other stages
foreach($this->stages as $stage) { foreach($this->stages as $stage) {
// Extra tables for _Live, etc. // Extra tables for _Live, etc.
//Change unique indexes to 'index'. Versioned tables may run into unique indexing difficulties otherwise.
foreach($indexes as $key=>$index){
if(is_array($index) && $index['type']=='unique'){
$indexes[$key]['type']='index';
}
}
if($stage != $this->defaultStage) { if($stage != $this->defaultStage) {
DB::requireTable("{$table}_$stage", $fields, $indexes, false); DB::requireTable("{$table}_$stage", $fields, $indexes, false);
} }