Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15414684
D19802.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19802.id.diff
View Options
diff --git a/resources/sql/autopatches/20180910.audit.03.status.php b/resources/sql/autopatches/20180910.audit.03.status.php
--- a/resources/sql/autopatches/20180910.audit.03.status.php
+++ b/resources/sql/autopatches/20180910.audit.03.status.php
@@ -12,17 +12,11 @@
5 => 'needs-verification',
);
-foreach (new LiskMigrationIterator($table) as $commit) {
- $status = $commit->getAuditStatus();
-
- if (!isset($status_map[$status])) {
- continue;
- }
-
+foreach ($status_map as $old_status => $new_status) {
queryfx(
$conn,
- 'UPDATE %T SET auditStatus = %s WHERE id = %d',
- $table->getTableName(),
- $status_map[$status],
- $commit->getID());
+ 'UPDATE %R SET auditStatus = %s WHERE auditStatus = %s',
+ $table,
+ $new_status,
+ $old_status);
}
diff --git a/resources/sql/autopatches/20180914.audit.01.mailkey.php b/resources/sql/autopatches/20180914.audit.01.mailkey.php
--- a/resources/sql/autopatches/20180914.audit.01.mailkey.php
+++ b/resources/sql/autopatches/20180914.audit.01.mailkey.php
@@ -8,19 +8,27 @@
$conn = $properties_table->establishConnection('w');
$iterator = new LiskRawMigrationIterator($commit_conn, $commit_name);
-foreach ($iterator as $commit) {
+$chunks = new PhutilChunkedIterator($iterator, 100);
+foreach ($chunks as $chunk) {
+ $sql = array();
+ foreach ($chunk as $commit) {
+ $sql[] = qsprintf(
+ $conn,
+ '(%s, %s, %d, %d)',
+ $commit['phid'],
+ phutil_json_encode(
+ array(
+ 'mailKey' => $commit['mailKey'],
+ )),
+ PhabricatorTime::getNow(),
+ PhabricatorTime::getNow());
+ }
+
queryfx(
$conn,
- 'INSERT IGNORE INTO %T
+ 'INSERT IGNORE INTO %R
(objectPHID, mailProperties, dateCreated, dateModified)
- VALUES
- (%s, %s, %d, %d)',
- $properties_table->getTableName(),
- $commit['phid'],
- phutil_json_encode(
- array(
- 'mailKey' => $commit['mailKey'],
- )),
- PhabricatorTime::getNow(),
- PhabricatorTime::getNow());
+ VALUES %LQ',
+ $properties_table,
+ $sql);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 1:56 AM (6 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7324650
Default Alt Text
D19802.id.diff (2 KB)
Attached To
Mode
D19802: Improve performance of two recent commit migrations
Attached
Detach File
Event Timeline
Log In to Comment