@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
1<?php
2
3final class PhabricatorRepositorySchemaSpec
4 extends PhabricatorConfigSchemaSpec {
5
6 public function buildSchemata() {
7 $this->buildEdgeSchemata(new PhabricatorRepository());
8
9 $this->buildRawSchema(
10 id(new PhabricatorRepository())->getApplicationName(),
11 PhabricatorRepository::TABLE_COVERAGE,
12 array(
13 'id' => 'auto',
14 'branchID' => 'id',
15 'commitID' => 'id',
16 'pathID' => 'id',
17 'coverage' => 'bytes',
18 ),
19 array(
20 'PRIMARY' => array(
21 'columns' => array('id'),
22 'unique' => true,
23 ),
24 'key_path' => array(
25 'columns' => array('branchID', 'pathID', 'commitID'),
26 'unique' => true,
27 ),
28 ));
29
30 $this->buildRawSchema(
31 id(new PhabricatorRepository())->getApplicationName(),
32 PhabricatorRepository::TABLE_FILESYSTEM,
33 array(
34 'repositoryID' => 'id',
35 'parentID' => 'id',
36 'svnCommit' => 'uint32',
37 'pathID' => 'id',
38 'existed' => 'bool',
39 'fileType' => 'uint32',
40 ),
41 array(
42 'PRIMARY' => array(
43 'columns' => array('repositoryID', 'parentID', 'pathID', 'svnCommit'),
44 'unique' => true,
45 ),
46 'repositoryID' => array(
47 'columns' => array('repositoryID', 'svnCommit'),
48 ),
49 ));
50
51 $this->buildRawSchema(
52 id(new PhabricatorRepository())->getApplicationName(),
53 PhabricatorRepository::TABLE_LINTMESSAGE,
54 array(
55 'id' => 'auto',
56 'branchID' => 'id',
57 'path' => 'text',
58 'line' => 'uint32',
59 'authorPHID' => 'phid?',
60 'code' => 'text32',
61 'severity' => 'text16',
62 'name' => 'text255',
63 'description' => 'text',
64 ),
65 array(
66 'PRIMARY' => array(
67 'columns' => array('id'),
68 'unique' => true,
69 ),
70 'branchID' => array(
71 'columns' => array('branchID', 'path(64)'),
72 ),
73 'branchID_2' => array(
74 'columns' => array('branchID', 'code', 'path(64)'),
75 ),
76 'key_author' => array(
77 'columns' => array('authorPHID'),
78 ),
79 ));
80
81 $this->buildRawSchema(
82 id(new PhabricatorRepository())->getApplicationName(),
83 PhabricatorRepository::TABLE_PARENTS,
84 array(
85 'id' => 'auto',
86 'childCommitID' => 'id',
87 'parentCommitID' => 'id',
88 ),
89 array(
90 'PRIMARY' => array(
91 'columns' => array('id'),
92 'unique' => true,
93 ),
94 'key_child' => array(
95 'columns' => array('childCommitID', 'parentCommitID'),
96 'unique' => true,
97 ),
98 'key_parent' => array(
99 'columns' => array('parentCommitID'),
100 ),
101 ));
102
103 $this->buildRawSchema(
104 id(new PhabricatorRepository())->getApplicationName(),
105 PhabricatorRepository::TABLE_PATH,
106 array(
107 'id' => 'auto',
108 'path' => 'text',
109 'pathHash' => 'bytes32',
110 ),
111 array(
112 'PRIMARY' => array(
113 'columns' => array('id'),
114 'unique' => true,
115 ),
116 'pathHash' => array(
117 'columns' => array('pathHash'),
118 'unique' => true,
119 ),
120 ));
121
122 $this->buildRawSchema(
123 id(new PhabricatorRepository())->getApplicationName(),
124 PhabricatorRepository::TABLE_PATHCHANGE,
125 array(
126 'repositoryID' => 'id',
127 'pathID' => 'id',
128 'commitID' => 'id',
129 'targetPathID' => 'id?',
130 'targetCommitID' => 'id?',
131 'changeType' => 'uint32',
132 'fileType' => 'uint32',
133 'isDirect' => 'bool',
134 'commitSequence' => 'uint32',
135 ),
136 array(
137 'PRIMARY' => array(
138 'columns' => array('commitID', 'pathID'),
139 'unique' => true,
140 ),
141 'repositoryID' => array(
142 'columns' => array('repositoryID', 'pathID', 'commitSequence'),
143 ),
144 ));
145
146 $this->buildRawSchema(
147 id(new PhabricatorRepository())->getApplicationName(),
148 PhabricatorRepository::TABLE_SUMMARY,
149 array(
150 'repositoryID' => 'id',
151 'size' => 'uint32',
152 'lastCommitID' => 'id',
153 'epoch' => 'epoch?',
154 ),
155 array(
156 'PRIMARY' => array(
157 'columns' => array('repositoryID'),
158 'unique' => true,
159 ),
160 'key_epoch' => array(
161 'columns' => array('epoch'),
162 ),
163 ));
164
165 }
166
167}