BUGFIX Fixed double quotes around column names in Versioned::augmentDatabase() (from r110914)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112867 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-19 03:03:19 +00:00
parent 0b2ed12c63
commit 4c0afd2564

View File

@ -319,20 +319,20 @@ class Versioned extends DataObjectDecorator {
$count = DB::query("
SELECT COUNT(*) FROM \"{$table}_versions\"
LEFT JOIN \"{$child}_versions\"
ON \"{$child}_versions\".RecordID = \"{$table}_versions\".RecordID
AND \"{$child}_versions\".Version = \"{$table}_versions\".Version
WHERE \"{$child}_versions\".ID IS NULL
ON \"{$child}_versions\".\"RecordID\" = \"{$table}_versions\".\"RecordID\"
AND \"{$child}_versions\".\"Version\" = \"{$table}_versions\".\"Version\"
WHERE \"{$child}_versions\".\"ID\" IS NULL
")->value();
if($count > 0) {
DB::alteration_message("Removing orphaned versioned records", "deleted");
$effectedIDs = DB::query("
SELECT \"{$table}_versions\".ID FROM \"{$table}_versions\"
SELECT \"{$table}_versions\".\"ID\" FROM \"{$table}_versions\"
LEFT JOIN \"{$child}_versions\"
ON \"{$child}_versions\".RecordID = \"{$table}_versions\".RecordID
AND \"{$child}_versions\".Version = \"{$table}_versions\".Version
WHERE \"{$child}_versions\".ID IS NULL
ON \"{$child}_versions\".\"RecordID\" = \"{$table}_versions\".\"RecordID\"
AND \"{$child}_versions\".\"Version\" = \"{$table}_versions\".\"Version\"
WHERE \"{$child}_versions\".\"ID\" IS NULL
")->column();
if(is_array($effectedIDs)) {