mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Modernize "mailKey" for Calendar Event
Summary: Ref T13065. Migrate "mailKey" and drop the column. Test Plan: Ran "bin/storage upgrade", got a clean report, saw migrated data in mail properties table. Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13065 Differential Revision: https://secure.phabricator.com/D21633
This commit is contained in:
parent
86669ab54f
commit
eeb009b4fa
3 changed files with 32 additions and 9 deletions
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
$event_table = new PhabricatorCalendarEvent();
|
||||
$event_conn = $event_table->establishConnection('w');
|
||||
|
||||
$properties_table = new PhabricatorMetaMTAMailProperties();
|
||||
$conn = $properties_table->establishConnection('w');
|
||||
|
||||
$iterator = new LiskRawMigrationIterator(
|
||||
$event_conn,
|
||||
$event_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());
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_calendar.calendar_event
|
||||
DROP mailKey;
|
|
@ -24,7 +24,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
protected $isCancelled;
|
||||
protected $isAllDay;
|
||||
protected $icon;
|
||||
protected $mailKey;
|
||||
protected $isStub;
|
||||
|
||||
protected $isRecurring = 0;
|
||||
|
@ -360,10 +359,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
}
|
||||
|
||||
public function save() {
|
||||
if (!$this->mailKey) {
|
||||
$this->mailKey = Filesystem::readRandomCharacters(20);
|
||||
}
|
||||
|
||||
$import_uid = $this->getImportUID();
|
||||
if ($import_uid !== null) {
|
||||
$index = PhabricatorHash::digestForIndex($import_uid);
|
||||
|
@ -405,7 +400,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
'isCancelled' => 'bool',
|
||||
'isAllDay' => 'bool',
|
||||
'icon' => 'text32',
|
||||
'mailKey' => 'bytes20',
|
||||
'isRecurring' => 'bool',
|
||||
'seriesParentPHID' => 'phid?',
|
||||
'instanceOfEventPHID' => 'phid?',
|
||||
|
@ -442,9 +436,8 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorCalendarEventPHIDType::TYPECONST);
|
||||
public function getPHIDType() {
|
||||
return PhabricatorCalendarEventPHIDType::TYPECONST;
|
||||
}
|
||||
|
||||
public function getMonogram() {
|
||||
|
|
Loading…
Reference in a new issue