@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Force Differential draft uniqueness

Summary: Ref T1191. A couple of installs have hit issues with this table, so clean it up before adjustment adds a unique key to it.

Test Plan: Dropped key, added duplicate rows, ran patch, got cleanup, ran adjust to get the key back.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10799

+30
+30
resources/sql/autopatches/20141106.uniqdrafts.php
··· 1 + <?php 2 + 3 + // Destroy duplicate drafts before storage adjustment adds a unique key to this 4 + // table. See T1191. We retain the newest draft. 5 + 6 + // (We can't easily do this in a single SQL statement because MySQL won't let us 7 + // modify a table that's joined in a subquery.) 8 + 9 + $table = new DifferentialDraft(); 10 + $conn_w = $table->establishConnection('w'); 11 + 12 + $duplicates = queryfx_all( 13 + $conn_w, 14 + 'SELECT DISTINCT u.id id FROM %T u 15 + JOIN %T v 16 + ON u.objectPHID = v.objectPHID 17 + AND u.authorPHID = v.authorPHID 18 + AND u.draftKey = v.draftKey 19 + AND u.id < v.id', 20 + $table->getTableName(), 21 + $table->getTableName()); 22 + 23 + $duplicates = ipull($duplicates, 'id'); 24 + foreach (PhabricatorLiskDAO::chunkSQL($duplicates) as $chunk) { 25 + queryfx( 26 + $conn_w, 27 + 'DELETE FROM %T WHERE id IN (%Q)', 28 + $table->getTableName(), 29 + $chunk); 30 + }