-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API renaming SiteTree->OwnerID column because it conflicts with the b…
…log module
- Loading branch information
Julian Seidenberg
committed
Mar 18, 2013
1 parent
26ba97a
commit 72c3fac
Showing
8 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* Task which migrates the ContentReview Module's SiteTree->OwnerID column to a new column name | ||
*/ | ||
class ContentReviewOwnerMigrationTask extends BuildTask { | ||
public function run($request) { | ||
$results = DB::query('SHOW columns from "SiteTree" WHERE "field" = \'OwnerID\''); | ||
if ($results->numRecords() == 0) { | ||
echo "<h1>No need to run task. SiteTree->OwnerID doesn't exist</h1>"; | ||
} else { | ||
DB::query('UPDATE "SiteTree" SET "ContentReviewOwnerID" = "OwnerID"'); | ||
DB::query('UPDATE "SiteTree_Live" SET "ContentReviewOwnerID" = "OwnerID"'); | ||
DB::query('UPDATE "SiteTree_versions" SET "ContentReviewOwnerID" = "OwnerID"'); | ||
DB::query('ALTER TABLE "SiteTree" DROP COLUMN "OwnerID"'); | ||
DB::query('ALTER TABLE "SiteTree_Live" DROP COLUMN "OwnerID"'); | ||
DB::query('ALTER TABLE "SiteTree_versions" DROP COLUMN "OwnerID"'); | ||
echo "<h1>Migrated 3 tables. Dropped obsolete OwnerID column</h1>"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters