mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Remove "mailKey" from "PhabricatorRepositoryCommit"
Summary: Ref T13197. Ref T13065. This continues the gradual purge of dedicated "mailKey" columns in favor of shared infrastructure. Test Plan: - Ran migration. - Visually inspected database. - Grepped for `mailKey`. - Added some comments, saw the daemons generate corresponding mail. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13197, T13065 Differential Revision: https://secure.phabricator.com/D19670
This commit is contained in:
parent
2ddc770fd8
commit
40d5d5c984
3 changed files with 28 additions and 10 deletions
26
resources/sql/autopatches/20180914.audit.01.mailkey.php
Normal file
26
resources/sql/autopatches/20180914.audit.01.mailkey.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
$commit_table = new PhabricatorRepositoryCommit();
|
||||
$commit_conn = $commit_table->establishConnection('w');
|
||||
$commit_name = $commit_table->getTableName();
|
||||
|
||||
$properties_table = new PhabricatorMetaMTAMailProperties();
|
||||
$conn = $properties_table->establishConnection('w');
|
||||
|
||||
$iterator = new LiskRawMigrationIterator($commit_conn, $commit_name);
|
||||
foreach ($iterator as $commit) {
|
||||
queryfx(
|
||||
$conn,
|
||||
'INSERT IGNORE INTO %T
|
||||
(objectPHID, mailProperties, dateCreated, dateModified)
|
||||
VALUES
|
||||
(%s, %s, %d, %d)',
|
||||
$properties_table->getTableName(),
|
||||
$commit['phid'],
|
||||
phutil_json_encode(
|
||||
array(
|
||||
'mailKey' => $commit['mailKey'],
|
||||
)),
|
||||
PhabricatorTime::getNow(),
|
||||
PhabricatorTime::getNow());
|
||||
}
|
2
resources/sql/autopatches/20180914.audit.02.rmkey.sql
Normal file
2
resources/sql/autopatches/20180914.audit.02.rmkey.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_repository.repository_commit
|
||||
DROP mailKey;
|
|
@ -25,7 +25,6 @@ final class PhabricatorRepositoryCommit
|
|||
protected $committerIdentityPHID;
|
||||
protected $commitIdentifier;
|
||||
protected $epoch;
|
||||
protected $mailKey;
|
||||
protected $authorPHID;
|
||||
protected $auditStatus = DiffusionCommitAuditStatus::NONE;
|
||||
protected $summary = '';
|
||||
|
@ -116,7 +115,6 @@ final class PhabricatorRepositoryCommit
|
|||
self::CONFIG_TIMESTAMPS => false,
|
||||
self::CONFIG_COLUMN_SCHEMA => array(
|
||||
'commitIdentifier' => 'text40',
|
||||
'mailKey' => 'bytes20',
|
||||
'authorPHID' => 'phid?',
|
||||
'authorIdentityPHID' => 'phid?',
|
||||
'committerIdentityPHID' => 'phid?',
|
||||
|
@ -321,13 +319,6 @@ final class PhabricatorRepositoryCommit
|
|||
return mpull($audits, 'getAuditorPHID');
|
||||
}
|
||||
|
||||
public function save() {
|
||||
if (!$this->mailKey) {
|
||||
$this->mailKey = Filesystem::readRandomCharacters(20);
|
||||
}
|
||||
return parent::save();
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$data = $this->loadCommitData();
|
||||
$audits = id(new PhabricatorRepositoryAuditRequest())
|
||||
|
@ -605,7 +596,6 @@ final class PhabricatorRepositoryCommit
|
|||
'phid' => $this->getPHID(),
|
||||
'commitIdentifier' => $this->getCommitIdentifier(),
|
||||
'epoch' => $this->getEpoch(),
|
||||
'mailKey' => $this->getMailKey(),
|
||||
'authorPHID' => $this->getAuthorPHID(),
|
||||
'auditStatus' => $this->getAuditStatus(),
|
||||
'summary' => $this->getSummary(),
|
||||
|
|
Loading…
Reference in a new issue