From 03d6e7f1b699d89c829e92ba0da2178b41ad1d6a Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 23 Feb 2016 17:21:27 -0800 Subject: [PATCH] Correct an old issue with Paste by restoring the file attachment edge Summary: I'm having trouble figuring out exactly what the timeframe on this was, but for a while in November we were not writing edges between pastes and their attached files correctly. An example of this on this install is here: https://secure.phabricator.com/P1893 That will start working once the migration runs, but until it does it shows this: {F1126605} This got fixed so recent stuff works fine, but it looks like WMF updated while the bug was active so they have more affected pastes than we do (we only have about 10). Test Plan: Ran this query to find pastes with missing edges: ``` select id, FROM_UNIXTIME(p.dateCreated) from pastebin_paste p LEFT JOIN edge ON edge.src = p.phid AND edge.type = 25 WHERE edge.dst IS NULL order by id; ``` Ran the migration. Verified the edges were fixed. Viewed one of the affected pastes, things now worked properly. Reviewers: chad Reviewed By: chad Subscribers: 20after4 Differential Revision: https://secure.phabricator.com/D15340 --- .../autopatches/20160223.paste.fileedges.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 resources/sql/autopatches/20160223.paste.fileedges.php diff --git a/resources/sql/autopatches/20160223.paste.fileedges.php b/resources/sql/autopatches/20160223.paste.fileedges.php new file mode 100644 index 0000000000..915a2fcd0e --- /dev/null +++ b/resources/sql/autopatches/20160223.paste.fileedges.php @@ -0,0 +1,21 @@ +getPHID(); + $file_phid = $paste->getFilePHID(); + + if (!$file_phid) { + continue; + } + + id(new PhabricatorEdgeEditor()) + ->addEdge($paste_phid, $edge_type, $file_phid) + ->save(); +}