1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00
phorge-phorge/resources/sql/autopatches/20150503.repositorysymbols.2.php
Joshua Spence 7bea116b00 Change migrations to not rely on "arcanist project" classes
Summary: Ref T7604. Change two migrations to query arcanist project information using `queryfx` directly to avoid the need for the `LiskDAO` fields to exist.

Test Plan:
Ran the following commands to verify that things weren't majorly broken:

  - `./bin/storage upgrade --apply phabricator:20150503.repositorysymbols.2.php`
  - `./bin/storage upgrade --no-quickstart --namespace test`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D13011
2015-06-01 15:35:13 +10:00

29 lines
665 B
PHP

<?php
$table = new PhabricatorRepositorySymbol();
$conn_w = $table->establishConnection('w');
$projects = queryfx_all(
$conn_w,
'SELECT * FROM %T',
'repository_arcanistproject');
foreach ($projects as $project) {
$repo = id(new PhabricatorRepositoryQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withIDs(array($project['repository']))
->executeOne();
if (!$repo) {
continue;
}
echo pht("Migrating symbols for '%s' project...\n", $project['name']);
queryfx(
$conn_w,
'UPDATE %T SET repositoryPHID = %s WHERE arcanistProjectID = %d',
$table->getTableName(),
$repo->getPHID(),
$project['id']);
}