Index: trunk/extensions/CodeReview/codereview.pg.sql |
— | — | @@ -0,0 +1,202 @@ |
| 2 | +CREATE SEQUENCE cr_code_repo_seq; |
| 3 | + |
| 4 | +CREATE TABLE code_repo ( |
| 5 | + repo_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('cr_code_repo_seq'), |
| 6 | + |
| 7 | + repo_name TEXT NOT NULL, |
| 8 | + |
| 9 | + repo_path TEXT NOT NULL, |
| 10 | + |
| 11 | + repo_viewvc TEXT, |
| 12 | + |
| 13 | + repo_bugzilla TEXT |
| 14 | +); |
| 15 | + |
| 16 | +CREATE INDEX code_repo_repo_name ON code_repo (repo_name); |
| 17 | + |
| 18 | +CREATE TYPE cr_cr_status AS ENUM ('new', 'fixme', 'reverted', 'resolved', 'ok', 'verified', 'deferred'); |
| 19 | +CREATE TABLE code_rev ( |
| 20 | + cr_repo_id INTEGER NOT NULL, |
| 21 | + |
| 22 | + cr_id INTEGER NOT NULL, |
| 23 | + |
| 24 | + cr_timestamp TIMESTAMPTZ, |
| 25 | + |
| 26 | + cr_author TEXT, |
| 27 | + |
| 28 | + cr_message TEXT, |
| 29 | + |
| 30 | + cr_status CR_CR_STATUS NOT NULL DEFAULT 'new', |
| 31 | + |
| 32 | + cr_path TEXT, |
| 33 | + |
| 34 | + cr_diff TEXT NULL, |
| 35 | + |
| 36 | + cr_flags TEXT NOT NULL DEFAULT '', |
| 37 | + |
| 38 | + PRIMARY KEY (cr_repo_id, cr_id) |
| 39 | +); |
| 40 | + |
| 41 | +CREATE INDEX cr_repo_ts ON code_rev (cr_repo_id, cr_timestamp); |
| 42 | +CREATE INDEX cr_repo_author ON code_rev (cr_repo_id, cr_author, cr_timestamp); |
| 43 | + |
| 44 | +CREATE TABLE code_authors ( |
| 45 | + ca_repo_id INTEGER NOT NULL, |
| 46 | + |
| 47 | + ca_author TEXT, |
| 48 | + |
| 49 | + ca_user_text TEXT, |
| 50 | + |
| 51 | + primary key (ca_repo_id, ca_author), |
| 52 | + |
| 53 | + unique (ca_user_text, ca_repo_id, ca_author) |
| 54 | +); |
| 55 | + |
| 56 | +CREATE TYPE code_path_action AS ENUM ('M', 'A', 'D', 'R'); |
| 57 | +CREATE TABLE code_paths ( |
| 58 | + cp_repo_id INTEGER NOT NULL, |
| 59 | + cp_rev_id INTEGER NOT NULL, |
| 60 | + |
| 61 | + cp_path TEXT NOT NULL, |
| 62 | + |
| 63 | + cp_action CODE_PATH_ACTION, |
| 64 | + |
| 65 | + primary key (cp_repo_id, cp_rev_id, cp_path) |
| 66 | +); |
| 67 | + |
| 68 | + |
| 69 | +CREATE TABLE code_relations ( |
| 70 | + cf_repo_id INTEGER NOT NULL, |
| 71 | + |
| 72 | + cf_from INTEGER NOT NULL, |
| 73 | + |
| 74 | + cf_to INTEGER NOT NULL, |
| 75 | + |
| 76 | + primary key (cf_repo_id, cf_from, cf_to) |
| 77 | +); |
| 78 | +CREATE INDEX cr_repo_to_from ON code_relations (cf_repo_id, cf_to, cf_from); |
| 79 | + |
| 80 | +CREATE TABLE code_bugs ( |
| 81 | + cb_repo_id INTEGER NOT NULL, |
| 82 | + |
| 83 | + cb_from INTEGER NOT NULL, |
| 84 | + |
| 85 | + cb_bug INTEGER NOT NULL, |
| 86 | + |
| 87 | + primary key (cb_repo_id, cb_from, cb_bug) |
| 88 | +); |
| 89 | +CREATE INDEX cb_repo_bug ON code_bugs (cb_repo_id, cb_bug, cb_from); |
| 90 | + |
| 91 | +CREATE TABLE code_tags ( |
| 92 | + ct_repo_id INTEGER NOT NULL, |
| 93 | + ct_rev_id INTEGER NOT NULL, |
| 94 | + ct_tag TEXT NOT NULL, |
| 95 | + |
| 96 | + primary key (ct_repo_id,ct_rev_id,ct_tag) |
| 97 | +); |
| 98 | +CREATE INDEX ct_repo_tag ON code_tage (ct_repo_id,ct_tag,ct_rev_id); |
| 99 | + |
| 100 | +CREATE SEQUENCE cc_id_seq; |
| 101 | +CREATE TABLE code_comment ( |
| 102 | + cc_id INTEGER NOT NULL DEFAULT nextval('cc_id_seq'), |
| 103 | + |
| 104 | + cc_repo_id INTEGER NOT NULL, |
| 105 | + cc_rev_id INTEGER NOT NULL, |
| 106 | + |
| 107 | + cc_text TEXT, |
| 108 | + |
| 109 | + cc_parent INTEGER, |
| 110 | + |
| 111 | + cc_user INTEGER NOT NULL, |
| 112 | + cc_user_text TEXT NOT NULL, |
| 113 | + |
| 114 | + cc_timestamp TIMESTAMPTZ NOT NULL, |
| 115 | + |
| 116 | + cc_sortkey TEXT, |
| 117 | + |
| 118 | + cc_review INTEGER, |
| 119 | + |
| 120 | + primary key (cc_id) |
| 121 | +); |
| 122 | +CREATE INDEX cc_repo_id_rev ON code_comment (cc_repo_id,cc_rev_id,cc_sortkey); |
| 123 | +CREATE INDEX cc_repo_time ON code_comment (cc_repo_id,cc_timestamp); |
| 124 | + |
| 125 | +CREATE TYPE cp_attrib AS ENUM ('status','tags'); |
| 126 | +CREATE TABLE code_prop_changes ( |
| 127 | + cpc_repo_id INTEGER NOT NULL, |
| 128 | + cpc_rev_id INTEGER NOT NULL, |
| 129 | + |
| 130 | + cpc_attrib CP_ATTRIB NOT NULL, |
| 131 | + |
| 132 | + cpc_removed TEXT, |
| 133 | + cpc_added TEXT, |
| 134 | + |
| 135 | + cpc_timestamp TIMESTAMPTZ NOT NULL default now(), |
| 136 | + |
| 137 | + cpc_user INTEGER NOT NULL, |
| 138 | + cpc_user_text TEXT NOT NULL |
| 139 | + |
| 140 | +); |
| 141 | + |
| 142 | +CREATE INDEX cpc_repo_rev_time ON code_prop_changes (cpc_repo_id, cpc_rev_id, cpc_timestamp); |
| 143 | +CREATE INDEX cpc_repo_time ON code_prop_changes (cpc_repo_id, cpc_timestamp); |
| 144 | + |
| 145 | +DROP TABLE IF EXISTS code_test_suite; |
| 146 | + |
| 147 | +CREATE SEQUENCE ct_ctsuite_id_seq; |
| 148 | +CREATE TABLE code_test_suite ( |
| 149 | + ctsuite_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('ct_ctsuite_id_seq'), |
| 150 | + |
| 151 | + ctsuite_repo_id INTEGER NOT NULL, |
| 152 | + |
| 153 | + ctsuite_branch_path TEXT NOT NULL, |
| 154 | + |
| 155 | + ctsuite_name TEXT NOT NULL, |
| 156 | + |
| 157 | + ctsuite_desc TEXT NOT NULL |
| 158 | +); |
| 159 | + |
| 160 | +DROP TABLE IF EXISTS code_test_case; |
| 161 | + |
| 162 | +CREATE SEQUENCE ct_ctcase_id_seq; |
| 163 | +CREATE TABLE code_test_case ( |
| 164 | + ctcase_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('ct_ctcase_id_seq'), |
| 165 | + ctcase_suite_id INTEGER NOT NULL, |
| 166 | + ctcase_name TEXT NOT NULL |
| 167 | + |
| 168 | +); |
| 169 | + |
| 170 | +CREATE INDEX ct_ctcase_id ON code_test_case (ctcase_suite_id, ctcase_id); |
| 171 | + |
| 172 | +DROP TABLE IF EXISTS code_test_run; |
| 173 | + |
| 174 | +CREATE SEQUENCE ct_ctrun_id_seq; |
| 175 | +CREATE TYPE code_test_status AS ENUM('running','complete','abort'); |
| 176 | +CREATE TABLE code_test_run ( |
| 177 | + ctrun_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('ct_ctrun_id_seq'), |
| 178 | + |
| 179 | + ctrun_suite_id INTEGER NOT NULL, |
| 180 | + ctrun_rev_id INTEGER NOT NULL, |
| 181 | + |
| 182 | + ctrun_status CODE_TEST_STATUS, |
| 183 | + |
| 184 | + ctrun_count_total INTEGER, |
| 185 | + ctrun_count_success INTEGER |
| 186 | +); |
| 187 | + |
| 188 | +CREATE INDEX suite_rev ON code_test_run (ctrun_suite_id, ctrun_rev_id); |
| 189 | + |
| 190 | +DROP TABLE IF EXISTS code_test_result; |
| 191 | +CREATE SEQUENCE ct_ctresult_id_seq; |
| 192 | +CREATE TABLE code_test_result ( |
| 193 | + ctresult_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('ct_ctresult_id_seq'), |
| 194 | + |
| 195 | + ctresult_run_id INTEGER NOT NULL, |
| 196 | + ctresult_case_id INTEGER NOT NULL, |
| 197 | + |
| 198 | + ctresult_success bool NOT NULL, |
| 199 | + |
| 200 | + ctresult_details TEXT |
| 201 | +); |
| 202 | + |
| 203 | +CREATE INDEX run_id ON code_test_result (ctresult_run_id, ctresult_id); |
Property changes on: trunk/extensions/CodeReview/codereview.pg.sql |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 204 | + native |