1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00
phorge-phorge/resources/sql/autopatches/20140211.dx.3.migsubscriptions.sql
epriestley 8f9b7f4196 Move Differential to proper subscriptions
Summary:
Ref T2222. Ref T4415. We're still writing Differential subscription stuff into this weird legacy `differential_relationship` table, which is like an edge table but extremely ancient.

Move it into a proper table.

I've removed `withSubscriptions()` from `DifferentialRevisionQuery`. It was weird, doesn't work consistently with other similar filters, and was only used by the API. Now it means "ccs", which is consistent with the ApplicationSearch UI and with Maniphest.

Test Plan:
Without migrating, added and removed subscribers via various workflows. Queried for subscribers. Everything worked as expected.

Ran the migration, verified data survived.

Reviewers: btrahan

Reviewed By: btrahan

CC: FacebookPOC, aran

Maniphest Tasks: T2222, T4415

Differential Revision: https://secure.phabricator.com/D8202
2014-02-12 08:53:40 -08:00

10 lines
393 B
SQL

/* For `grep`: */
/* PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER = 21 */
INSERT IGNORE INTO {$NAMESPACE}_differential.edge (src, type, dst, seq)
SELECT rev.phid, 21, rel.objectPHID, rel.sequence
FROM {$NAMESPACE}_differential.differential_revision rev
JOIN {$NAMESPACE}_differential.differential_relationship rel
ON rev.id = rel.revisionID
WHERE relation = 'subd';