mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 22:40:55 +01:00
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
This commit is contained in:
parent
8403812e15
commit
607e99490b
2 changed files with 24 additions and 5 deletions
24
resources/sql/autopatches/20140815.cancdncase.php
Normal file
24
resources/sql/autopatches/20140815.cancdncase.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// This corrects files which incorrectly had a 'cancdn' property written;
|
||||||
|
// the property should be 'canCDN'.
|
||||||
|
|
||||||
|
$table = new PhabricatorFile();
|
||||||
|
$conn_w = $table->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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -849,11 +849,6 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
||||||
return false;
|
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);
|
return idx($this->metadata, self::METADATA_CAN_CDN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue