mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
dc510354c3
Summary: Depends on D19426. Ref T13130. Ref T13065. While I'm making changes to Owners for "Ignore generated paths", clean up the "mailKey" column. We recently (D19399) added code to automatically generate and manage mail keys so we don't need a ton of `mailKey` properties in the future. Migrate existing mail keys and blow away the explicit column on packages. Test Plan: Ran migration, manually looked at the database and saw sensible data. Edited a package to send some mail, which looked good. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13130, T13065 Differential Revision: https://secure.phabricator.com/D19427
26 lines
758 B
PHP
26 lines
758 B
PHP
<?php
|
|
|
|
$packages_table = new PhabricatorOwnersPackage();
|
|
$packages_conn = $packages_table->establishConnection('w');
|
|
$packages_name = $packages_table->getTableName();
|
|
|
|
$properties_table = new PhabricatorMetaMTAMailProperties();
|
|
$conn = $properties_table->establishConnection('w');
|
|
|
|
$iterator = new LiskRawMigrationIterator($packages_conn, $packages_name);
|
|
foreach ($iterator as $package) {
|
|
queryfx(
|
|
$conn,
|
|
'INSERT IGNORE INTO %T
|
|
(objectPHID, mailProperties, dateCreated, dateModified)
|
|
VALUES
|
|
(%s, %s, %d, %d)',
|
|
$properties_table->getTableName(),
|
|
$package['phid'],
|
|
phutil_json_encode(
|
|
array(
|
|
'mailKey' => $package['mailKey'],
|
|
)),
|
|
PhabricatorTime::getNow(),
|
|
PhabricatorTime::getNow());
|
|
}
|