1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-03 04:02:43 +01:00
phorge-phorge/resources/sql/autopatches/20150503.repositorysymbols.2.php
Joshua Spence 2483f6f120 Move symbols to be repository-based
Summary: Fixes T7220. Ref T7977. Changes symbols from being bound to an Arcanist project to being bound to a repository.

Test Plan:
- Added symbols and then applied migrations, symbols seemed to be migrated successfully.
- Tested the `/diffusion/symbol/$SYMBOL_NAME` endpoint.
- Tested the `/diffusion/symbol/$SYMBOL_NAME` endpoint with the `?repositories=$REPOSITORY_PHID` parameter.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: avivey, Korvin, epriestley

Maniphest Tasks: T7977, T7220

Differential Revision: https://secure.phabricator.com/D12608
2015-05-03 13:23:07 +10:00

26 lines
609 B
PHP

<?php
$projects = id(new PhabricatorRepositoryArcanistProjectQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->needRepositories(true)
->execute();
$table = new PhabricatorRepositorySymbol();
$conn_w = $table->establishConnection('w');
foreach ($projects as $project) {
$repo = $project->getRepository();
if (!$repo) {
continue;
}
echo pht("Migrating symbols for '%s' project...\n", $project->getName());
queryfx(
$conn_w,
'UPDATE %T SET repositoryPHID = %s WHERE arcanistProjectID = %d',
$table->getTableName(),
$repo->getPHID(),
$project->getID());
}