From 196cabb2f05aa1886fc8b9283254791bdf83773c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 24 Nov 2010 06:23:49 +0000 Subject: [PATCH] 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 --- core/model/Versioned.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/model/Versioned.php b/core/model/Versioned.php index d7dfcd105..4b30eb65b 100755 --- a/core/model/Versioned.php +++ b/core/model/Versioned.php @@ -249,6 +249,13 @@ class Versioned extends DataObjectDecorator { // Create tables for other stages foreach($this->stages as $stage) { // 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) { DB::requireTable("{$table}_$stage", $fields, $indexes, false); }