1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Add mail keys to ReleephRequests

Summary: Adding mail-keys; required for `PhabricatorApplicationTransaction` support.

Test Plan: Upgrade an old database with this patch, observe the matrix: {F42620}

Reviewers: wez, epriestley

Reviewed By: epriestley

CC: epriestley, aran

Maniphest Tasks: T2720

Differential Revision: https://secure.phabricator.com/D5852
This commit is contained in:
Edward Speyer 2013-05-08 10:38:07 +01:00
parent 5b2fc6a184
commit 58f0f37873
4 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_releeph.releeph_request
ADD COLUMN `mailKey` varchar(20) NOT NULL;

View file

@ -0,0 +1,27 @@
<?php
echo "Populating Releeph requests with mail keys...\n";
$table = new ReleephRequest();
$table->openTransaction();
// From ponder-mailkey-populate.php...
foreach (new LiskMigrationIterator($table) as $rq) {
$id = $rq->getID();
echo "RQ{$id}: ";
if (!$rq->getMailKey()) {
queryfx(
$rq->establishConnection('w'),
'UPDATE %T SET mailKey = %s WHERE id = %d',
$rq->getTableName(),
Filesystem::readRandomCharacters(20),
$id);
echo("Generated Key\n");
} else {
echo "-\n";
}
}
$table->saveTransaction();
echo "Done.\n";

View file

@ -9,6 +9,7 @@ final class ReleephRequest extends ReleephDAO {
protected $userIntents = array();
protected $inBranch;
protected $pickStatus;
protected $mailKey;
// Information about the thing being requested
protected $requestCommitPHID;
@ -153,6 +154,13 @@ final class ReleephRequest extends ReleephDAO {
ReleephPHIDConstants::PHID_TYPE_RERQ);
}
public function save() {
if (!$this->getMailKey()) {
$this->setMailKey(Filesystem::readRandomCharacters(20));
}
return parent::save();
}
/* -( Helpful accessors )--------------------------------------------------- */

View file

@ -1274,6 +1274,14 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'sql',
'name' => $this->getPatchPath('20130507.releephrqsimplifycols.sql'),
),
'20130507.releephrqmailkey.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('20130507.releephrqmailkey.sql'),
),
'20130507.releephrqmailkeypop.php' => array(
'type' => 'php',
'name' => $this->getPatchPath('20130507.releephrqmailkeypop.php'),
),
);
}
}