From 607e99490ba373f55457369151c3386dc1c2de93 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 15 Aug 2014 11:07:40 -0700 Subject: [PATCH] Migrate "cancdn" to "canCDN" in the database Summary: Ref T5884. We migrated with "canCDN" and then had live writes with "cancdn". Move everything to "canCDN" for consistency. Test Plan: Ran migration, verified DB only has "canCDN" afterward. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5884 Differential Revision: https://secure.phabricator.com/D10273 --- .../sql/autopatches/20140815.cancdncase.php | 24 +++++++++++++++++++ .../files/storage/PhabricatorFile.php | 5 ---- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 resources/sql/autopatches/20140815.cancdncase.php diff --git a/resources/sql/autopatches/20140815.cancdncase.php b/resources/sql/autopatches/20140815.cancdncase.php new file mode 100644 index 0000000000..400fdbb01a --- /dev/null +++ b/resources/sql/autopatches/20140815.cancdncase.php @@ -0,0 +1,24 @@ +establishConnection('w'); +foreach (new LiskMigrationIterator($table) as $file) { + $id = $file->getID(); + echo "Updating capitalization of canCDN property for file {$id}...\n"; + $meta = $file->getMetadata(); + + if (isset($meta['cancdn'])) { + $meta['canCDN'] = $meta['cancdn']; + unset($meta['cancdn']); + + queryfx( + $conn_w, + 'UPDATE %T SET metadata = %s WHERE id = %d', + $table->getTableName(), + json_encode($meta), + $id); + } +} diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index 3591012def..91ac6b244d 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -849,11 +849,6 @@ final class PhabricatorFile extends PhabricatorFileDAO return false; } - // TODO: Migrate away this old constant and remove this check. - if (idx($this->metadata, 'cancdn')) { - return true; - } - return idx($this->metadata, self::METADATA_CAN_CDN); }