mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Drop DifferentialDraft storage
Summary: Fixes T12104. Test Plan: Ran `bin/storage upgrade` and observed table dun got dropped. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Maniphest Tasks: T12104 Differential Revision: https://secure.phabricator.com/D18034
This commit is contained in:
parent
742c3a834f
commit
04fd93e51e
4 changed files with 2 additions and 53 deletions
|
@ -1,30 +1,3 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Destroy duplicate drafts before storage adjustment adds a unique key to this
|
// This table has been removed; see T12104 for details.
|
||||||
// table. See T1191. We retain the newest draft.
|
|
||||||
|
|
||||||
// (We can't easily do this in a single SQL statement because MySQL won't let us
|
|
||||||
// modify a table that's joined in a subquery.)
|
|
||||||
|
|
||||||
$table = new DifferentialDraft();
|
|
||||||
$conn_w = $table->establishConnection('w');
|
|
||||||
|
|
||||||
$duplicates = queryfx_all(
|
|
||||||
$conn_w,
|
|
||||||
'SELECT DISTINCT u.id id FROM %T u
|
|
||||||
JOIN %T v
|
|
||||||
ON u.objectPHID = v.objectPHID
|
|
||||||
AND u.authorPHID = v.authorPHID
|
|
||||||
AND u.draftKey = v.draftKey
|
|
||||||
AND u.id < v.id',
|
|
||||||
$table->getTableName(),
|
|
||||||
$table->getTableName());
|
|
||||||
|
|
||||||
$duplicates = ipull($duplicates, 'id');
|
|
||||||
foreach (PhabricatorLiskDAO::chunkSQL($duplicates) as $chunk) {
|
|
||||||
queryfx(
|
|
||||||
$conn_w,
|
|
||||||
'DELETE FROM %T WHERE id IN (%Q)',
|
|
||||||
$table->getTableName(),
|
|
||||||
$chunk);
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
DROP TABLE {$NAMESPACE}_differential.differential_draft;
|
|
@ -441,7 +441,6 @@ phutil_register_library_map(array(
|
||||||
'DifferentialDiffTransactionQuery' => 'applications/differential/query/DifferentialDiffTransactionQuery.php',
|
'DifferentialDiffTransactionQuery' => 'applications/differential/query/DifferentialDiffTransactionQuery.php',
|
||||||
'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php',
|
'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php',
|
||||||
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php',
|
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php',
|
||||||
'DifferentialDraft' => 'applications/differential/storage/DifferentialDraft.php',
|
|
||||||
'DifferentialExactUserFunctionDatasource' => 'applications/differential/typeahead/DifferentialExactUserFunctionDatasource.php',
|
'DifferentialExactUserFunctionDatasource' => 'applications/differential/typeahead/DifferentialExactUserFunctionDatasource.php',
|
||||||
'DifferentialFieldParseException' => 'applications/differential/exception/DifferentialFieldParseException.php',
|
'DifferentialFieldParseException' => 'applications/differential/exception/DifferentialFieldParseException.php',
|
||||||
'DifferentialFieldValidationException' => 'applications/differential/exception/DifferentialFieldValidationException.php',
|
'DifferentialFieldValidationException' => 'applications/differential/exception/DifferentialFieldValidationException.php',
|
||||||
|
@ -5391,7 +5390,6 @@ phutil_register_library_map(array(
|
||||||
'DifferentialDiffTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
'DifferentialDiffTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
'DifferentialDiffViewController' => 'DifferentialController',
|
'DifferentialDiffViewController' => 'DifferentialController',
|
||||||
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher',
|
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher',
|
||||||
'DifferentialDraft' => 'DifferentialDAO',
|
|
||||||
'DifferentialExactUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
|
'DifferentialExactUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
|
||||||
'DifferentialFieldParseException' => 'Exception',
|
'DifferentialFieldParseException' => 'Exception',
|
||||||
'DifferentialFieldValidationException' => 'Exception',
|
'DifferentialFieldValidationException' => 'Exception',
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class DifferentialDraft extends DifferentialDAO {
|
|
||||||
|
|
||||||
protected $objectPHID;
|
|
||||||
protected $authorPHID;
|
|
||||||
protected $draftKey;
|
|
||||||
|
|
||||||
protected function getConfiguration() {
|
|
||||||
return array(
|
|
||||||
self::CONFIG_COLUMN_SCHEMA => array(
|
|
||||||
'draftKey' => 'text64',
|
|
||||||
),
|
|
||||||
self::CONFIG_KEY_SCHEMA => array(
|
|
||||||
'key_unique' => array(
|
|
||||||
'columns' => array('objectPHID', 'authorPHID', 'draftKey'),
|
|
||||||
'unique' => true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
) + parent::getConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue