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:
parent
5b2fc6a184
commit
58f0f37873
4 changed files with 45 additions and 0 deletions
2
resources/sql/patches/20130507.releephrqmailkey.sql
Normal file
2
resources/sql/patches/20130507.releephrqmailkey.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_releeph.releeph_request
|
||||
ADD COLUMN `mailKey` varchar(20) NOT NULL;
|
27
resources/sql/patches/20130507.releephrqmailkeypop.php
Normal file
27
resources/sql/patches/20130507.releephrqmailkeypop.php
Normal 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";
|
|
@ -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 )--------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -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'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue