Remove on-object mailkeys from Phriction
Summary: Depends on D19619. Ref T13065. Ref T13077. Migrate Phriction mail keys to the new infrastructure and drop the column. Test Plan: Ran migrations, spot-checked the database. Reviewers: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13077, T13065 Differential Revision: https://secure.phabricator.com/D19620
This commit is contained in:
26
resources/sql/autopatches/20180829.phriction.01.mailkey.php
Normal file
26
resources/sql/autopatches/20180829.phriction.01.mailkey.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
$document_table = new PhrictionDocument();
|
||||
$document_conn = $document_table->establishConnection('w');
|
||||
$document_name = $document_table->getTableName();
|
||||
|
||||
$properties_table = new PhabricatorMetaMTAMailProperties();
|
||||
$conn = $properties_table->establishConnection('w');
|
||||
|
||||
$iterator = new LiskRawMigrationIterator($document_conn, $document_name);
|
||||
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}_phriction.phriction_document
|
||||
DROP mailKey;
|
||||
Reference in New Issue
Block a user