mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 09:20:58 +01:00
f0db6e4818
Summary: Modernize Project edges to subclass `PhabricatorEdgeType`. Largely based on D11045. Test Plan: Add a member to a project, saw new rows in the `phabricator_project.edge` and `phabricator_user.edge` tables. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11111
35 lines
759 B
PHP
35 lines
759 B
PHP
<?php
|
|
|
|
echo "Migrating project members to edges...\n";
|
|
$table = new PhabricatorProject();
|
|
$table->establishConnection('w');
|
|
|
|
foreach (new LiskMigrationIterator($table) as $proj) {
|
|
$id = $proj->getID();
|
|
echo "Project {$id}: ";
|
|
|
|
$members = queryfx_all(
|
|
$proj->establishConnection('w'),
|
|
'SELECT userPHID FROM %T WHERE projectPHID = %s',
|
|
'project_affiliation',
|
|
$proj->getPHID());
|
|
|
|
if (!$members) {
|
|
echo "-\n";
|
|
continue;
|
|
}
|
|
|
|
$members = ipull($members, 'userPHID');
|
|
|
|
$editor = new PhabricatorEdgeEditor();
|
|
foreach ($members as $user_phid) {
|
|
$editor->addEdge(
|
|
$proj->getPHID(),
|
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST,
|
|
$user_phid);
|
|
}
|
|
$editor->save();
|
|
echo "OKAY\n";
|
|
}
|
|
|
|
echo "Done.\n";
|