@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

Add database storage for a dedicated file attachment table

Summary: Ref T13603. Prepare to move this relationship out of edge storage into dedicated storage so it is easier to formalize better in the UI.

Test Plan: Ran `bin/storage upgrade`.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13603

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

+42
+9
resources/sql/autopatches/20220510.file.01.attach.sql
··· 1 + CREATE TABLE {$NAMESPACE}_file.file_attachment ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + objectPHID VARBINARY(64) NOT NULL, 4 + filePHID VARBINARY(64) NOT NULL, 5 + attacherPHID VARBINARY(64), 6 + attachmentMode VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT}, 7 + dateCreated INT UNSIGNED NOT NULL, 8 + dateModified INT UNSIGNED NOT NULL 9 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+2
src/__phutil_library_map__.php
··· 3450 3450 'PhabricatorFile' => 'applications/files/storage/PhabricatorFile.php', 3451 3451 'PhabricatorFileAES256StorageFormat' => 'applications/files/format/PhabricatorFileAES256StorageFormat.php', 3452 3452 'PhabricatorFileAltTextTransaction' => 'applications/files/xaction/PhabricatorFileAltTextTransaction.php', 3453 + 'PhabricatorFileAttachment' => 'applications/files/storage/PhabricatorFileAttachment.php', 3453 3454 'PhabricatorFileBundleLoader' => 'applications/files/query/PhabricatorFileBundleLoader.php', 3454 3455 'PhabricatorFileChunk' => 'applications/files/storage/PhabricatorFileChunk.php', 3455 3456 'PhabricatorFileChunkIterator' => 'applications/files/engine/PhabricatorFileChunkIterator.php', ··· 9888 9889 ), 9889 9890 'PhabricatorFileAES256StorageFormat' => 'PhabricatorFileStorageFormat', 9890 9891 'PhabricatorFileAltTextTransaction' => 'PhabricatorFileTransactionType', 9892 + 'PhabricatorFileAttachment' => 'PhabricatorFileDAO', 9891 9893 'PhabricatorFileBundleLoader' => 'Phobject', 9892 9894 'PhabricatorFileChunk' => array( 9893 9895 'PhabricatorFileDAO',
+31
src/applications/files/storage/PhabricatorFileAttachment.php
··· 1 + <?php 2 + 3 + final class PhabricatorFileAttachment 4 + extends PhabricatorFileDAO { 5 + 6 + protected $objectPHID; 7 + protected $filePHID; 8 + protected $attacherPHID; 9 + protected $attachmentMode; 10 + 11 + protected function getConfiguration() { 12 + return array( 13 + self::CONFIG_COLUMN_SCHEMA => array( 14 + 'objectPHID' => 'phid', 15 + 'filePHID' => 'phid', 16 + 'attacherPHID' => 'phid?', 17 + 'attachmentMode' => 'text32', 18 + ), 19 + self::CONFIG_KEY_SCHEMA => array( 20 + 'key_object' => array( 21 + 'columns' => array('objectPHID', 'filePHID'), 22 + 'unique' => true, 23 + ), 24 + 'key_file' => array( 25 + 'columns' => array('filePHID'), 26 + ), 27 + ), 28 + ) + parent::getConfiguration(); 29 + } 30 + 31 + }