mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
Give Phriction documents modern string status constants instead of numeric constants
Summary: Depends on D19099. Ref T13077. Updates Phriction documents to string constants to make API interactions cleaner and statuses more practical to extend. This does not seem to require any transaction migrations because none of the Phriction transactions actually store status values: status is always a side effect of other edits. Test Plan: Created, edited, deleted, moved documents. Saw appropriate UI cues. Browsed and filtered documents by status in the index. Maniphest Tasks: T13077 Differential Revision: https://secure.phabricator.com/D19100
This commit is contained in:
parent
c1056f6dab
commit
143350fdba
5 changed files with 19 additions and 6 deletions
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_phriction.phriction_document
|
||||
CHANGE status status VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT};
|
|
@ -0,0 +1,11 @@
|
|||
UPDATE {$NAMESPACE}_phriction.phriction_document
|
||||
SET status = 'active' WHERE status = '0';
|
||||
|
||||
UPDATE {$NAMESPACE}_phriction.phriction_document
|
||||
SET status = 'deleted' WHERE status = '1';
|
||||
|
||||
UPDATE {$NAMESPACE}_phriction.phriction_document
|
||||
SET status = 'moved' WHERE status = '2';
|
||||
|
||||
UPDATE {$NAMESPACE}_phriction.phriction_document
|
||||
SET status = 'stub' WHERE status = '3';
|
|
@ -3,10 +3,10 @@
|
|||
final class PhrictionDocumentStatus
|
||||
extends PhabricatorObjectStatus {
|
||||
|
||||
const STATUS_EXISTS = 0;
|
||||
const STATUS_DELETED = 1;
|
||||
const STATUS_MOVED = 2;
|
||||
const STATUS_STUB = 3;
|
||||
const STATUS_EXISTS = 'active';
|
||||
const STATUS_DELETED = 'deleted';
|
||||
const STATUS_MOVED = 'moved';
|
||||
const STATUS_STUB = 'stub';
|
||||
|
||||
public static function getConduitConstant($const) {
|
||||
static $map = array(
|
||||
|
|
|
@ -196,7 +196,7 @@ final class PhrictionDocumentQuery
|
|||
if ($this->statuses !== null) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'd.status IN (%Ld)',
|
||||
'd.status IN (%Ls)',
|
||||
$this->statuses);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ final class PhrictionDocument extends PhrictionDAO
|
|||
'slug' => 'sort128',
|
||||
'depth' => 'uint32',
|
||||
'contentID' => 'id?',
|
||||
'status' => 'uint32',
|
||||
'status' => 'text32',
|
||||
'mailKey' => 'bytes20',
|
||||
),
|
||||
self::CONFIG_KEY_SCHEMA => array(
|
||||
|
|
Loading…
Reference in a new issue