mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
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
This commit is contained in:
parent
6fea5e5ce7
commit
cfa42c5e65
3 changed files with 42 additions and 0 deletions
9
resources/sql/autopatches/20220510.file.01.attach.sql
Normal file
9
resources/sql/autopatches/20220510.file.01.attach.sql
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_file.file_attachment (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
objectPHID VARBINARY(64) NOT NULL,
|
||||||
|
filePHID VARBINARY(64) NOT NULL,
|
||||||
|
attacherPHID VARBINARY(64),
|
||||||
|
attachmentMode VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT},
|
||||||
|
dateCreated INT UNSIGNED NOT NULL,
|
||||||
|
dateModified INT UNSIGNED NOT NULL
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -3450,6 +3450,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorFile' => 'applications/files/storage/PhabricatorFile.php',
|
'PhabricatorFile' => 'applications/files/storage/PhabricatorFile.php',
|
||||||
'PhabricatorFileAES256StorageFormat' => 'applications/files/format/PhabricatorFileAES256StorageFormat.php',
|
'PhabricatorFileAES256StorageFormat' => 'applications/files/format/PhabricatorFileAES256StorageFormat.php',
|
||||||
'PhabricatorFileAltTextTransaction' => 'applications/files/xaction/PhabricatorFileAltTextTransaction.php',
|
'PhabricatorFileAltTextTransaction' => 'applications/files/xaction/PhabricatorFileAltTextTransaction.php',
|
||||||
|
'PhabricatorFileAttachment' => 'applications/files/storage/PhabricatorFileAttachment.php',
|
||||||
'PhabricatorFileBundleLoader' => 'applications/files/query/PhabricatorFileBundleLoader.php',
|
'PhabricatorFileBundleLoader' => 'applications/files/query/PhabricatorFileBundleLoader.php',
|
||||||
'PhabricatorFileChunk' => 'applications/files/storage/PhabricatorFileChunk.php',
|
'PhabricatorFileChunk' => 'applications/files/storage/PhabricatorFileChunk.php',
|
||||||
'PhabricatorFileChunkIterator' => 'applications/files/engine/PhabricatorFileChunkIterator.php',
|
'PhabricatorFileChunkIterator' => 'applications/files/engine/PhabricatorFileChunkIterator.php',
|
||||||
|
@ -9888,6 +9889,7 @@ phutil_register_library_map(array(
|
||||||
),
|
),
|
||||||
'PhabricatorFileAES256StorageFormat' => 'PhabricatorFileStorageFormat',
|
'PhabricatorFileAES256StorageFormat' => 'PhabricatorFileStorageFormat',
|
||||||
'PhabricatorFileAltTextTransaction' => 'PhabricatorFileTransactionType',
|
'PhabricatorFileAltTextTransaction' => 'PhabricatorFileTransactionType',
|
||||||
|
'PhabricatorFileAttachment' => 'PhabricatorFileDAO',
|
||||||
'PhabricatorFileBundleLoader' => 'Phobject',
|
'PhabricatorFileBundleLoader' => 'Phobject',
|
||||||
'PhabricatorFileChunk' => array(
|
'PhabricatorFileChunk' => array(
|
||||||
'PhabricatorFileDAO',
|
'PhabricatorFileDAO',
|
||||||
|
|
31
src/applications/files/storage/PhabricatorFileAttachment.php
Normal file
31
src/applications/files/storage/PhabricatorFileAttachment.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorFileAttachment
|
||||||
|
extends PhabricatorFileDAO {
|
||||||
|
|
||||||
|
protected $objectPHID;
|
||||||
|
protected $filePHID;
|
||||||
|
protected $attacherPHID;
|
||||||
|
protected $attachmentMode;
|
||||||
|
|
||||||
|
protected function getConfiguration() {
|
||||||
|
return array(
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'objectPHID' => 'phid',
|
||||||
|
'filePHID' => 'phid',
|
||||||
|
'attacherPHID' => 'phid?',
|
||||||
|
'attachmentMode' => 'text32',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'key_object' => array(
|
||||||
|
'columns' => array('objectPHID', 'filePHID'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'key_file' => array(
|
||||||
|
'columns' => array('filePHID'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) + parent::getConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue