Page MenuHomePhabricator

D21625.diff
No OneTemporary

D21625.diff

diff --git a/resources/sql/autopatches/20210316.almanac.01.device-mailkey.php b/resources/sql/autopatches/20210316.almanac.01.device-mailkey.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20210316.almanac.01.device-mailkey.php
@@ -0,0 +1,28 @@
+<?php
+
+$device_table = new AlmanacDevice();
+$device_conn = $device_table->establishConnection('w');
+
+$properties_table = new PhabricatorMetaMTAMailProperties();
+$conn = $properties_table->establishConnection('w');
+
+$iterator = new LiskRawMigrationIterator(
+ $device_conn,
+ $device_table->getTableName());
+
+foreach ($iterator as $row) {
+ queryfx(
+ $conn,
+ 'INSERT IGNORE INTO %R
+ (objectPHID, mailProperties, dateCreated, dateModified)
+ VALUES
+ (%s, %s, %d, %d)',
+ $properties_table,
+ $row['phid'],
+ phutil_json_encode(
+ array(
+ 'mailKey' => $row['mailKey'],
+ )),
+ PhabricatorTime::getNow(),
+ PhabricatorTime::getNow());
+}
diff --git a/resources/sql/autopatches/20210316.almanac.02.device-dropmailkey.sql b/resources/sql/autopatches/20210316.almanac.02.device-dropmailkey.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20210316.almanac.02.device-dropmailkey.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_almanac.almanac_device
+ DROP mailKey;
diff --git a/src/applications/almanac/storage/AlmanacDevice.php b/src/applications/almanac/storage/AlmanacDevice.php
--- a/src/applications/almanac/storage/AlmanacDevice.php
+++ b/src/applications/almanac/storage/AlmanacDevice.php
@@ -15,7 +15,6 @@
protected $name;
protected $nameIndex;
- protected $mailKey;
protected $viewPolicy;
protected $editPolicy;
protected $isBoundToClusterService;
@@ -36,7 +35,6 @@
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text128',
'nameIndex' => 'bytes12',
- 'mailKey' => 'bytes20',
'isBoundToClusterService' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
@@ -60,10 +58,6 @@
$this->nameIndex = PhabricatorHash::digestForIndex($this->getName());
- if (!$this->mailKey) {
- $this->mailKey = Filesystem::readRandomCharacters(20);
- }
-
return parent::save();
}

File Metadata

Mime Type
text/plain
Expires
May 18 2024, 5:05 AM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6293609
Default Alt Text
D21625.diff (2 KB)

Event Timeline