mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Remove the onboard "mailKey" from Pholio Mocks
Summary: Depends on D19921. Ref T11351. Ref T13065. Update Pholio to use the shared mail infrastructure. See D19670 for a previous change in this vein. Test Plan: Ran upgrade, spot-checked that everything made it into the new table alive. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13065, T11351 Differential Revision: https://secure.phabricator.com/D19922
This commit is contained in:
parent
28989ac231
commit
1e2bc7775b
3 changed files with 32 additions and 16 deletions
28
resources/sql/autopatches/20181220.pholio.01.mailkey.php
Normal file
28
resources/sql/autopatches/20181220.pholio.01.mailkey.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
$mock_table = new PholioMock();
|
||||
$mock_conn = $mock_table->establishConnection('w');
|
||||
|
||||
$properties_table = new PhabricatorMetaMTAMailProperties();
|
||||
$conn = $properties_table->establishConnection('w');
|
||||
|
||||
$iterator = new LiskRawMigrationIterator(
|
||||
$mock_conn,
|
||||
$mock_table->getTableName());
|
||||
|
||||
foreach ($iterator as $row) {
|
||||
queryfx(
|
||||
$conn,
|
||||
'INSERT IGNORE INTO %T
|
||||
(objectPHID, mailProperties, dateCreated, dateModified)
|
||||
VALUES
|
||||
(%s, %s, %d, %d)',
|
||||
$properties_table->getTableName(),
|
||||
$row['phid'],
|
||||
phutil_json_encode(
|
||||
array(
|
||||
'mailKey' => $row['mailKey'],
|
||||
)),
|
||||
PhabricatorTime::getNow(),
|
||||
PhabricatorTime::getNow());
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_pholio.pholio_mock
|
||||
DROP mailKey;
|
|
@ -25,7 +25,6 @@ final class PholioMock extends PholioDAO
|
|||
protected $name;
|
||||
protected $description;
|
||||
protected $coverPHID;
|
||||
protected $mailKey;
|
||||
protected $status;
|
||||
protected $spacePHID;
|
||||
|
||||
|
@ -65,15 +64,9 @@ final class PholioMock extends PholioDAO
|
|||
self::CONFIG_COLUMN_SCHEMA => array(
|
||||
'name' => 'text128',
|
||||
'description' => 'text',
|
||||
'mailKey' => 'bytes20',
|
||||
'status' => 'text12',
|
||||
),
|
||||
self::CONFIG_KEY_SCHEMA => array(
|
||||
'key_phid' => null,
|
||||
'phid' => array(
|
||||
'columns' => array('phid'),
|
||||
'unique' => true,
|
||||
),
|
||||
'authorPHID' => array(
|
||||
'columns' => array('authorPHID'),
|
||||
),
|
||||
|
@ -81,15 +74,8 @@ final class PholioMock extends PholioDAO
|
|||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID('MOCK');
|
||||
}
|
||||
|
||||
public function save() {
|
||||
if (!$this->getMailKey()) {
|
||||
$this->setMailKey(Filesystem::readRandomCharacters(20));
|
||||
}
|
||||
return parent::save();
|
||||
public function getPHIDType() {
|
||||
return PholioMockPHIDType::TYPECONST;
|
||||
}
|
||||
|
||||
public function attachImages(array $images) {
|
||||
|
|
Loading…
Reference in a new issue