Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 1 | -- Copyright 2016 The Chromium Authors |
| 2 | -- Use of this source code is governed by a BSD-style license that can be |
| 3 | -- found in the LICENSE file. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
| 5 | |
| 6 | -- Create issue-realted tables in monorail db. |
| 7 | |
| 8 | |
| 9 | CREATE TABLE StatusDef ( |
| 10 | id INT NOT NULL AUTO_INCREMENT, |
| 11 | project_id SMALLINT UNSIGNED NOT NULL, |
| 12 | status VARCHAR(80) BINARY NOT NULL, |
| 13 | rank SMALLINT UNSIGNED, |
| 14 | means_open BOOLEAN, |
| 15 | docstring TEXT, |
| 16 | deprecated BOOLEAN DEFAULT FALSE, |
| 17 | |
| 18 | PRIMARY KEY (id), |
| 19 | UNIQUE KEY (project_id, status), |
| 20 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 21 | ) ENGINE=INNODB; |
| 22 | |
| 23 | |
| 24 | CREATE TABLE ComponentDef ( |
| 25 | id INT NOT NULL AUTO_INCREMENT, |
| 26 | project_id SMALLINT UNSIGNED NOT NULL, |
| 27 | |
| 28 | -- Note: parent components have paths that are prefixes of child components. |
| 29 | path VARCHAR(255) BINARY NOT NULL, |
| 30 | docstring TEXT, |
| 31 | deprecated BOOLEAN DEFAULT FALSE, |
| 32 | created INT, |
| 33 | creator_id INT UNSIGNED, |
| 34 | modified INT, |
| 35 | modifier_id INT UNSIGNED, |
| 36 | is_deleted BOOLEAN DEFAULT FALSE, |
| 37 | |
| 38 | PRIMARY KEY (id), |
| 39 | FOREIGN KEY (project_id) REFERENCES Project(project_id), |
| 40 | FOREIGN KEY (creator_id) REFERENCES User(user_id), |
| 41 | FOREIGN KEY (modifier_id) REFERENCES User(user_id), |
| 42 | INDEX project_id2 (project_id, path) |
| 43 | ) ENGINE=INNODB; |
| 44 | |
| 45 | |
| 46 | CREATE TABLE Component2Admin ( |
| 47 | component_id INT NOT NULL, |
| 48 | admin_id INT UNSIGNED NOT NULL, |
| 49 | |
| 50 | PRIMARY KEY (component_id, admin_id), |
| 51 | |
| 52 | FOREIGN KEY (component_id) REFERENCES ComponentDef(id), |
| 53 | FOREIGN KEY (admin_id) REFERENCES User(user_id) |
| 54 | ) ENGINE=INNODB; |
| 55 | |
| 56 | |
| 57 | CREATE TABLE Component2Cc ( |
| 58 | component_id INT NOT NULL, |
| 59 | cc_id INT UNSIGNED NOT NULL, |
| 60 | |
| 61 | PRIMARY KEY (component_id, cc_id), |
| 62 | |
| 63 | FOREIGN KEY (component_id) REFERENCES ComponentDef(id), |
| 64 | FOREIGN KEY (cc_id) REFERENCES User(user_id) |
| 65 | ) ENGINE=INNODB; |
| 66 | |
| 67 | |
| 68 | CREATE TABLE LabelDef ( |
| 69 | id INT NOT NULL AUTO_INCREMENT, |
| 70 | project_id SMALLINT UNSIGNED NOT NULL, |
| 71 | label VARCHAR(80) BINARY NOT NULL COLLATE utf8mb4_unicode_ci, |
| 72 | rank SMALLINT UNSIGNED, |
| 73 | docstring TEXT, |
| 74 | deprecated BOOLEAN DEFAULT FALSE, |
| 75 | |
| 76 | PRIMARY KEY (id), |
| 77 | UNIQUE KEY (project_id, label), |
| 78 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 79 | ) ENGINE=INNODB; |
| 80 | |
| 81 | |
| 82 | CREATE TABLE Component2Label ( |
| 83 | component_id INT NOT NULL, |
| 84 | label_id INT NOT NULL, |
| 85 | |
| 86 | PRIMARY KEY (component_id, label_id), |
| 87 | |
| 88 | FOREIGN KEY (component_id) REFERENCES ComponentDef(id), |
| 89 | FOREIGN KEY (label_id) REFERENCES LabelDef(id) |
| 90 | ) ENGINE=INNODB; |
| 91 | |
| 92 | |
| 93 | CREATE TABLE FieldDef ( |
| 94 | id INT NOT NULL AUTO_INCREMENT, |
| 95 | project_id SMALLINT UNSIGNED NOT NULL, |
| 96 | rank SMALLINT UNSIGNED, |
| 97 | |
| 98 | field_name VARCHAR(80) BINARY NOT NULL, |
| 99 | -- TODO(jrobbins): more types |
| 100 | field_type ENUM ('enum_type', 'int_type', 'str_type', 'user_type', 'date_type', 'url_type', 'approval_type') NOT NULL, |
| 101 | applicable_type VARCHAR(80), -- No value means: offered for all issue types |
| 102 | applicable_predicate TEXT, -- No value means: TRUE |
| 103 | is_required BOOLEAN, -- true means required if applicable |
| 104 | is_niche BOOLEAN, -- true means user must click to reveal widget |
| 105 | is_multivalued BOOLEAN, |
| 106 | -- TODO(jrobbins): access controls: restrict, grant |
| 107 | -- Validation for int_type fields |
| 108 | min_value INT, |
| 109 | max_value INT, |
| 110 | -- Validation for str_type fields |
| 111 | regex VARCHAR(80), |
| 112 | -- Validation for user_type fields |
| 113 | needs_member BOOLEAN, -- User value can only be set to users who are members |
| 114 | needs_perm VARCHAR(80), -- User value can only be set to users w/ that perm |
| 115 | grants_perm VARCHAR(80), -- User named in this field gains this perm in the issue |
| 116 | -- notification options for user_type fields |
| 117 | notify_on ENUM ('never', 'any_comment') DEFAULT 'never' NOT NULL, |
| 118 | -- notification options for date_type fields |
| 119 | date_action ENUM ('no_action', 'ping_owner_only', 'ping_participants'), |
| 120 | |
| 121 | -- TODO(jrobbins): default value |
| 122 | -- TODO(jrobbins): deprecated boolean? |
| 123 | docstring TEXT, |
| 124 | is_deleted BOOLEAN, -- If true, reap this field def after all values reaped. |
| 125 | approval_id INT, |
| 126 | is_phase_field BOOLEAN DEFAULT FALSE, |
| 127 | is_restricted_field BOOLEAN DEFAULT FALSE, -- If true, editors are restricted to the FieldDef2Editors tbl. |
| 128 | |
| 129 | PRIMARY KEY (id), |
| 130 | UNIQUE KEY (project_id, field_name), |
| 131 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 132 | ) ENGINE=INNODB; |
| 133 | |
| 134 | |
| 135 | CREATE TABLE FieldDef2Admin ( |
| 136 | field_id INT NOT NULL, |
| 137 | admin_id INT UNSIGNED NOT NULL, |
| 138 | |
| 139 | PRIMARY KEY (field_id, admin_id), |
| 140 | FOREIGN KEY (field_id) REFERENCES FieldDef(id), |
| 141 | FOREIGN KEY (admin_id) REFERENCES User(user_id) |
| 142 | ) ENGINE=INNODB; |
| 143 | |
| 144 | |
| 145 | CREATE TABLE FieldDef2Editor ( |
| 146 | field_id INT NOT NULL, |
| 147 | editor_id INT UNSIGNED NOT NULL, |
| 148 | |
| 149 | PRIMARY KEY (field_id, editor_id), |
| 150 | FOREIGN KEY (field_id) REFERENCES FieldDef(id), |
| 151 | FOREIGN KEY (editor_id) REFERENCES User(user_id) |
| 152 | ) ENGINE=INNODB; |
| 153 | |
| 154 | |
| 155 | CREATE TABLE Issue ( |
| 156 | id INT NOT NULL AUTO_INCREMENT, |
| 157 | shard SMALLINT UNSIGNED DEFAULT 0 NOT NULL, |
| 158 | project_id SMALLINT UNSIGNED NOT NULL, |
| 159 | local_id INT NOT NULL, |
| 160 | |
| 161 | reporter_id INT UNSIGNED NOT NULL, |
| 162 | owner_id INT UNSIGNED, |
| 163 | status_id INT, |
| 164 | |
| 165 | -- These are each timestamps in seconds since the epoch. |
| 166 | modified INT NOT NULL, |
| 167 | opened INT, |
| 168 | closed INT, |
| 169 | owner_modified INT, |
| 170 | status_modified INT, |
| 171 | component_modified INT, |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 172 | migration_modified INT, |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 173 | |
| 174 | derived_owner_id INT UNSIGNED, |
| 175 | derived_status_id INT, |
| 176 | |
| 177 | deleted BOOLEAN, |
| 178 | |
| 179 | -- These are denormalized fields that should be updated when child |
| 180 | -- records are added or removed for stars or attachments. If they |
| 181 | -- get out of sync, they can be updated via an UPDATE ... SELECT statement. |
| 182 | star_count INT DEFAULT 0, |
| 183 | attachment_count INT DEFAULT 0, |
| 184 | |
| 185 | is_spam BOOLEAN DEFAULT FALSE, |
| 186 | |
| 187 | PRIMARY KEY(id), |
| 188 | UNIQUE KEY (project_id, local_id), |
| 189 | INDEX (shard, status_id), |
| 190 | INDEX (shard, project_id), |
| 191 | |
| 192 | FOREIGN KEY (project_id) REFERENCES Project(project_id), |
| 193 | FOREIGN KEY (reporter_id) REFERENCES User(user_id), |
| 194 | FOREIGN KEY (owner_id) REFERENCES User(user_id), |
| 195 | FOREIGN KEY (status_id) REFERENCES StatusDef(id), |
| 196 | FOREIGN KEY (derived_owner_id) REFERENCES User(user_id) |
| 197 | ) ENGINE=INNODB; |
| 198 | |
| 199 | |
| 200 | -- This is a parallel table to the Issue table because we don't want |
| 201 | -- any very wide columns in the Issue table that would slow it down. |
| 202 | CREATE TABLE IssueSummary ( |
| 203 | issue_id INT NOT NULL, |
| 204 | summary mediumtext COLLATE utf8mb4_unicode_ci, |
| 205 | |
| 206 | PRIMARY KEY (issue_id), |
| 207 | FOREIGN KEY (issue_id) REFERENCES Issue(id) |
| 208 | ) ENGINE=INNODB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
| 209 | |
| 210 | |
| 211 | CREATE TABLE Issue2Component ( |
| 212 | issue_id INT NOT NULL, |
| 213 | issue_shard SMALLINT UNSIGNED DEFAULT 0 NOT NULL, |
| 214 | component_id INT NOT NULL, |
| 215 | derived BOOLEAN DEFAULT FALSE, |
| 216 | |
| 217 | PRIMARY KEY (issue_id, component_id, derived), |
| 218 | INDEX (component_id, issue_shard), |
| 219 | |
| 220 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 221 | FOREIGN KEY (component_id) REFERENCES ComponentDef(id) |
| 222 | ) ENGINE=INNODB; |
| 223 | |
| 224 | |
| 225 | CREATE TABLE Issue2Label ( |
| 226 | issue_id INT NOT NULL, |
| 227 | issue_shard SMALLINT UNSIGNED DEFAULT 0 NOT NULL, |
| 228 | label_id INT NOT NULL, |
| 229 | derived BOOLEAN DEFAULT FALSE, |
| 230 | |
| 231 | PRIMARY KEY (issue_id, label_id, derived), |
| 232 | INDEX (label_id, issue_shard), |
| 233 | |
| 234 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 235 | FOREIGN KEY (label_id) REFERENCES LabelDef(id) |
| 236 | ) ENGINE=INNODB; |
| 237 | |
| 238 | CREATE TABLE IssuePhaseDef ( |
| 239 | id INT NOT NULL AUTO_INCREMENT, |
| 240 | name VARCHAR(255) BINARY NOT NULL, |
| 241 | rank SMALLINT UNSIGNED, |
| 242 | |
| 243 | PRIMARY KEY (id) |
| 244 | ) ENGINE=INNODB; |
| 245 | |
| 246 | CREATE TABLE Issue2FieldValue ( |
| 247 | issue_id INT NOT NULL, |
| 248 | issue_shard SMALLINT UNSIGNED DEFAULT 0 NOT NULL, |
| 249 | field_id INT NOT NULL, |
| 250 | |
| 251 | int_value INT, |
| 252 | str_value VARCHAR(1024), |
| 253 | user_id INT UNSIGNED, |
| 254 | date_value INT, |
| 255 | url_value VARCHAR(1024), |
| 256 | |
| 257 | derived BOOLEAN DEFAULT FALSE, |
| 258 | phase_id INT, |
| 259 | |
| 260 | INDEX (issue_id, field_id), |
| 261 | INDEX (field_id, issue_shard, int_value), |
| 262 | INDEX (field_id, issue_shard, str_value(255)), |
| 263 | INDEX (field_id, issue_shard, user_id), |
| 264 | INDEX (field_id, issue_shard, date_value), |
| 265 | INDEX (field_id, issue_shard, url_value(255)), |
| 266 | |
| 267 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 268 | FOREIGN KEY (field_id) REFERENCES FieldDef(id), |
| 269 | FOREIGN KEY (user_id) REFERENCES User(user_id), |
| 270 | FOREIGN KEY (phase_id) REFERENCES IssuePhaseDef(id) |
| 271 | ) ENGINE=INNODB; |
| 272 | |
| 273 | |
| 274 | CREATE TABLE Issue2Cc ( |
| 275 | issue_id INT NOT NULL, |
| 276 | issue_shard SMALLINT UNSIGNED DEFAULT 0 NOT NULL, |
| 277 | cc_id INT UNSIGNED NOT NULL, |
| 278 | derived BOOLEAN DEFAULT FALSE, |
| 279 | |
| 280 | PRIMARY KEY (issue_id, cc_id), |
| 281 | INDEX (cc_id, issue_shard), |
| 282 | |
| 283 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 284 | FOREIGN KEY (cc_id) REFERENCES User(user_id) |
| 285 | ) ENGINE=INNODB; |
| 286 | |
| 287 | |
| 288 | CREATE TABLE Issue2Notify ( |
| 289 | issue_id INT NOT NULL, |
| 290 | email VARCHAR(80) NOT NULL, |
| 291 | |
| 292 | PRIMARY KEY (issue_id, email), |
| 293 | |
| 294 | FOREIGN KEY (issue_id) REFERENCES Issue(id) |
| 295 | ) ENGINE=INNODB; |
| 296 | |
| 297 | |
| 298 | CREATE TABLE IssueVisitHistory ( |
| 299 | issue_id INT NOT NULL, |
| 300 | user_id INT UNSIGNED NOT NULL, |
| 301 | viewed INT NOT NULL, |
| 302 | |
| 303 | PRIMARY KEY (user_id, issue_id), |
| 304 | INDEX (user_id, viewed), |
| 305 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 306 | FOREIGN KEY (user_id) REFERENCES User(user_id) |
| 307 | ) ENGINE=INNODB; |
| 308 | |
| 309 | |
| 310 | CREATE TABLE IssueStar ( |
| 311 | issue_id INT NOT NULL, |
| 312 | user_id INT UNSIGNED NOT NULL, |
| 313 | |
| 314 | PRIMARY KEY (issue_id, user_id), |
| 315 | INDEX (user_id), |
| 316 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 317 | FOREIGN KEY (user_id) REFERENCES User(user_id) |
| 318 | ) ENGINE=INNODB; |
| 319 | |
| 320 | |
| 321 | CREATE TABLE IssueRelation ( |
| 322 | issue_id INT NOT NULL, |
| 323 | dst_issue_id INT NOT NULL, |
| 324 | |
| 325 | -- Read as: src issue is blocked on dst issue. |
| 326 | kind ENUM ('blockedon', 'mergedinto') NOT NULL, |
| 327 | |
| 328 | rank BIGINT, |
| 329 | |
| 330 | PRIMARY KEY (issue_id, dst_issue_id, kind), |
| 331 | INDEX (issue_id), |
| 332 | INDEX (dst_issue_id), |
| 333 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 334 | FOREIGN KEY (dst_issue_id) REFERENCES Issue(id) |
| 335 | ) ENGINE=INNODB; |
| 336 | |
| 337 | |
| 338 | CREATE TABLE DanglingIssueRelation ( |
| 339 | issue_id INT NOT NULL, |
| 340 | dst_issue_project VARCHAR(80), |
| 341 | dst_issue_local_id INT, |
| 342 | ext_issue_identifier VARCHAR(255), |
| 343 | |
| 344 | -- This table uses 'blocking' so that it can guarantee the src issue |
| 345 | -- always exists, while the dst issue is always the dangling one. |
| 346 | kind ENUM ('blockedon', 'blocking', 'mergedinto') NOT NULL, |
| 347 | |
| 348 | PRIMARY KEY (issue_id, dst_issue_project, dst_issue_local_id, kind, ext_issue_identifier), |
| 349 | INDEX (issue_id), |
| 350 | INDEX (ext_issue_identifier), |
| 351 | FOREIGN KEY (issue_id) REFERENCES Issue(id) |
| 352 | ) ENGINE=INNODB; |
| 353 | |
| 354 | |
| 355 | CREATE TABLE CommentContent ( |
| 356 | id INT NOT NULL AUTO_INCREMENT, |
| 357 | -- TODO(jrobbins): drop comment_id after Comment.commentcontent_id is added. |
| 358 | comment_id INT NOT NULL, -- Note: no forign key reference. |
| 359 | content MEDIUMTEXT COLLATE utf8mb4_unicode_ci, |
| 360 | inbound_message MEDIUMTEXT COLLATE utf8mb4_unicode_ci, |
| 361 | |
| 362 | PRIMARY KEY (id) |
| 363 | ) ENGINE=INNODB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
| 364 | |
| 365 | |
| 366 | CREATE TABLE Comment ( |
| 367 | id INT NOT NULL AUTO_INCREMENT, |
| 368 | issue_id INT NOT NULL, |
| 369 | created INT NOT NULL, |
| 370 | project_id SMALLINT UNSIGNED NOT NULL, |
| 371 | |
| 372 | commenter_id INT UNSIGNED NOT NULL, |
| 373 | commentcontent_id INT, -- TODO(jrobbins) make this NOT NULL. |
| 374 | |
| 375 | deleted_by INT UNSIGNED, |
| 376 | is_spam BOOLEAN DEFAULT FALSE, |
| 377 | -- TODO(lukasperaza) Update first comments SET is_description=TRUE |
| 378 | is_description BOOLEAN DEFAULT FALSE, |
| 379 | |
| 380 | PRIMARY KEY(id), |
| 381 | INDEX (is_spam, project_id, created), |
| 382 | INDEX (commenter_id, created), |
| 383 | INDEX (commenter_id, deleted_by, issue_id), |
| 384 | |
| 385 | FOREIGN KEY (project_id) REFERENCES Project(project_id), |
| 386 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 387 | FOREIGN KEY (commenter_id) REFERENCES User(user_id), |
| 388 | FOREIGN KEY (deleted_by) REFERENCES User(user_id), |
| 389 | FOREIGN KEY (commentcontent_id) REFERENCES CommentContent(id) |
| 390 | ) ENGINE=INNODB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
| 391 | |
| 392 | |
| 393 | CREATE TABLE CommentImporter ( |
| 394 | comment_id INT NOT NULL, |
| 395 | importer_id INT UNSIGNED NOT NULL, |
| 396 | |
| 397 | PRIMARY KEY (comment_id), |
| 398 | FOREIGN KEY (comment_id) REFERENCES Comment(id), |
| 399 | FOREIGN KEY (importer_id) REFERENCES User(user_id) |
| 400 | ) ENGINE=INNODB; |
| 401 | |
| 402 | |
| 403 | CREATE TABLE Attachment ( |
| 404 | id INT NOT NULL AUTO_INCREMENT, |
| 405 | |
| 406 | issue_id INT NOT NULL, |
| 407 | comment_id INT, |
| 408 | |
| 409 | filename VARCHAR(255) NOT NULL, |
| 410 | filesize INT NOT NULL, |
| 411 | mimetype VARCHAR(255) NOT NULL, |
| 412 | deleted BOOLEAN, |
| 413 | gcs_object_id VARCHAR(1024) NOT NULL, |
| 414 | |
| 415 | PRIMARY KEY (id), |
| 416 | INDEX (issue_id), |
| 417 | INDEX (comment_id), |
| 418 | FOREIGN KEY (issue_id) REFERENCES Issue(id) |
| 419 | ) ENGINE=INNODB; |
| 420 | |
| 421 | |
| 422 | CREATE TABLE IssueUpdate ( |
| 423 | id INT NOT NULL AUTO_INCREMENT, |
| 424 | issue_id INT NOT NULL, |
| 425 | comment_id INT, |
| 426 | |
| 427 | field ENUM ( |
| 428 | 'summary', 'status', 'owner', 'cc', 'labels', 'blockedon', 'blocking', 'mergedinto', |
| 429 | 'project', 'components', 'custom', 'is_spam' ) NOT NULL, |
| 430 | old_value MEDIUMTEXT COLLATE utf8mb4_unicode_ci, |
| 431 | new_value MEDIUMTEXT COLLATE utf8mb4_unicode_ci, |
| 432 | added_user_id INT UNSIGNED, |
| 433 | removed_user_id INT UNSIGNED, |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 434 | added_component_id INT, |
| 435 | removed_component_id INT, |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 436 | custom_field_name VARCHAR(255), |
| 437 | is_spam BOOLEAN DEFAULT FALSE, |
| 438 | |
| 439 | PRIMARY KEY (id), |
| 440 | INDEX (issue_id), |
| 441 | INDEX (comment_id), |
| 442 | FOREIGN KEY (issue_id) REFERENCES Issue(id) |
| 443 | -- FOREIGN KEY (added_user_id) REFERENCES User(user_id), |
| 444 | -- FOREIGN KEY (removed_user_id) REFERENCES User(user_id) |
| 445 | ) ENGINE=INNODB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
| 446 | |
| 447 | |
| 448 | CREATE TABLE IssueFormerLocations ( |
| 449 | issue_id INT NOT NULL, |
| 450 | project_id SMALLINT UNSIGNED NOT NULL, |
| 451 | local_id INT NOT NULL, |
| 452 | |
| 453 | INDEX (issue_id), |
| 454 | UNIQUE KEY (project_id, local_id), |
| 455 | FOREIGN KEY (issue_id) REFERENCES Issue(id) |
| 456 | ) ENGINE=INNODB; |
| 457 | |
| 458 | |
| 459 | CREATE TABLE Template ( |
| 460 | id INT NOT NULL AUTO_INCREMENT, |
| 461 | project_id SMALLINT UNSIGNED NOT NULL, |
| 462 | name VARCHAR(255) BINARY NOT NULL, |
| 463 | |
| 464 | content TEXT, |
| 465 | summary TEXT, |
| 466 | summary_must_be_edited BOOLEAN, |
| 467 | owner_id INT UNSIGNED, |
| 468 | status VARCHAR(255), |
| 469 | members_only BOOLEAN, |
| 470 | owner_defaults_to_member BOOLEAN, |
| 471 | component_required BOOLEAN DEFAULT FALSE, |
| 472 | |
| 473 | PRIMARY KEY (id), |
| 474 | UNIQUE KEY (project_id, name), |
| 475 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 476 | ) ENGINE=INNODB; |
| 477 | |
| 478 | |
| 479 | CREATE TABLE Template2Label ( |
| 480 | template_id INT NOT NULL, |
| 481 | label VARCHAR(255) NOT NULL, |
| 482 | |
| 483 | PRIMARY KEY (template_id, label), |
| 484 | FOREIGN KEY (template_id) REFERENCES Template(id) |
| 485 | ) ENGINE=INNODB; |
| 486 | |
| 487 | |
| 488 | CREATE TABLE Template2Admin ( |
| 489 | template_id INT NOT NULL, |
| 490 | admin_id INT UNSIGNED NOT NULL, |
| 491 | |
| 492 | PRIMARY KEY (template_id, admin_id), |
| 493 | FOREIGN KEY (template_id) REFERENCES Template(id), |
| 494 | FOREIGN KEY (admin_id) REFERENCES User(user_id) |
| 495 | ) ENGINE=INNODB; |
| 496 | |
| 497 | |
| 498 | CREATE TABLE Template2FieldValue ( |
| 499 | template_id INT NOT NULL, |
| 500 | field_id INT NOT NULL, |
| 501 | |
| 502 | int_value INT, |
| 503 | str_value VARCHAR(1024), |
| 504 | user_id INT UNSIGNED, |
| 505 | date_value INT, |
| 506 | url_value VARCHAR(1024), |
| 507 | |
| 508 | INDEX (template_id, field_id), |
| 509 | |
| 510 | FOREIGN KEY (template_id) REFERENCES Template(id), |
| 511 | FOREIGN KEY (field_id) REFERENCES FieldDef(id), |
| 512 | FOREIGN KEY (user_id) REFERENCES User(user_id) |
| 513 | ) ENGINE=INNODB; |
| 514 | |
| 515 | |
| 516 | CREATE TABLE Template2Component ( |
| 517 | template_id INT NOT NULL, |
| 518 | component_id INT NOT NULL, |
| 519 | |
| 520 | PRIMARY KEY (template_id, component_id), |
| 521 | |
| 522 | FOREIGN KEY (template_id) REFERENCES Template(id), |
| 523 | FOREIGN KEY (component_id) REFERENCES ComponentDef(id) |
| 524 | ) ENGINE=INNODB; |
| 525 | |
| 526 | |
| 527 | CREATE TABLE Template2ApprovalValue ( |
| 528 | approval_id INT NOT NULL, |
| 529 | template_id INT NOT NULL, |
| 530 | phase_id INT, |
| 531 | status ENUM ('needs_review', 'na', 'review_requested', 'review_started', 'need_info', 'approved', 'not_approved', 'not_set') DEFAULT 'not_set' NOT NULL, |
| 532 | |
| 533 | PRIMARY KEY (approval_id, template_id), |
| 534 | |
| 535 | FOREIGN KEY (approval_id) REFERENCES FieldDef(id), |
| 536 | FOREIGN KEY (template_id) REFERENCES Template(id), |
| 537 | FOREIGN KEY (phase_id) REFERENCES IssuePhaseDef(id) |
| 538 | ) ENGINE=INNODB; |
| 539 | |
| 540 | |
| 541 | CREATE TABLE ProjectIssueConfig ( |
| 542 | project_id SMALLINT UNSIGNED NOT NULL, |
| 543 | |
| 544 | statuses_offer_merge VARCHAR(255) NOT NULL, |
| 545 | exclusive_label_prefixes VARCHAR(255) NOT NULL, |
| 546 | default_template_for_developers INT NOT NULL, |
| 547 | default_template_for_users INT NOT NULL, |
| 548 | default_col_spec TEXT, |
| 549 | default_sort_spec TEXT, |
| 550 | default_x_attr TEXT, |
| 551 | default_y_attr TEXT, |
| 552 | |
| 553 | member_default_query TEXT, |
| 554 | custom_issue_entry_url TEXT, |
| 555 | |
| 556 | PRIMARY KEY (project_id), |
| 557 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 558 | ) ENGINE=INNODB; |
| 559 | |
| 560 | |
| 561 | CREATE TABLE FilterRule ( |
| 562 | project_id SMALLINT UNSIGNED NOT NULL, |
| 563 | rank SMALLINT UNSIGNED, |
| 564 | |
| 565 | -- TODO: or should this be broken down into structured fields? |
| 566 | predicate TEXT NOT NULL, |
| 567 | -- TODO: or should this be broken down into structured fields? |
| 568 | consequence TEXT NOT NULL, |
| 569 | |
| 570 | INDEX (project_id), |
| 571 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 572 | ) ENGINE=INNODB; |
| 573 | |
| 574 | |
| 575 | -- Each row in this table indicates an issue that needs to be reindexed |
| 576 | -- in the GAE fulltext index by our batch indexing cron job. |
| 577 | CREATE TABLE ReindexQueue ( |
| 578 | issue_id INT NOT NULL, |
| 579 | created TIMESTAMP, |
| 580 | |
| 581 | PRIMARY KEY (issue_id), |
| 582 | INDEX (created), |
| 583 | FOREIGN KEY (issue_id) REFERENCES Issue(id) |
| 584 | ) ENGINE=INNODB; |
| 585 | |
| 586 | |
| 587 | -- This holds counters with the highest issue local_id that is |
| 588 | -- already used in each project. Clients should atomically increment |
| 589 | -- the value for current project and then use the new counter value |
| 590 | -- when creating an issue. |
| 591 | CREATE TABLE LocalIDCounter ( |
| 592 | project_id SMALLINT UNSIGNED NOT NULL, |
| 593 | used_local_id INT NOT NULL, |
| 594 | used_spam_id INT NOT NULL, |
| 595 | |
| 596 | PRIMARY KEY (project_id), |
| 597 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 598 | ) ENGINE=INNODB; |
| 599 | |
| 600 | |
| 601 | -- This is a saved query. It can be configured by a project owner to |
| 602 | -- be used by all visitors to that project. Or, it can be a a |
| 603 | -- personal saved query that appears on a user's "Saved queries" page |
| 604 | -- and executes in the scope of one or more projects. |
| 605 | CREATE TABLE SavedQuery ( |
| 606 | id INT NOT NULL AUTO_INCREMENT, |
| 607 | name VARCHAR(80) NOT NULL, |
| 608 | |
| 609 | -- For now, we only allow saved queries to be based off ane of the built-in |
| 610 | -- query scopes, and those can never be deleted, so there can be no nesting, |
| 611 | -- dangling references, and thus no need for cascading deletes. |
| 612 | base_query_id INT, |
| 613 | query TEXT NOT NULL, |
| 614 | |
| 615 | PRIMARY KEY (id) |
| 616 | ) ENGINE=INNODB; |
| 617 | |
| 618 | |
| 619 | -- Rows for built-in queries. These are in the database soley so that |
| 620 | -- foreign key constraints are satisfied. These rows ar never read or updated. |
| 621 | INSERT IGNORE INTO SavedQuery VALUES |
| 622 | (1, 'All issues', 0, ''), |
| 623 | (2, 'Open issues', 0, 'is:open'), |
| 624 | (3, 'Open and owned by me', 0, 'is:open owner:me'), |
| 625 | (4, 'Open and reported by me', 0, 'is:open reporter:me'), |
| 626 | (5, 'Open and starred by me', 0, 'is:open is:starred'), |
| 627 | (6, 'New issues', 0, 'status:new'), |
| 628 | (7, 'Issues to verify', 0, 'status=fixed,done'), |
| 629 | (8, 'Open with comment by me', 0, 'is:open commentby:me'); |
| 630 | |
| 631 | -- The sole purpose of this statement is to force user defined saved queries |
| 632 | -- to have IDs greater than 100 so that 1-100 are reserved for built-ins. |
| 633 | INSERT IGNORE INTO SavedQuery VALUES (100, '', 0, ''); |
| 634 | |
| 635 | |
| 636 | -- User personal queries default to executing in the context of the |
| 637 | -- project where they were created, but the user can edit them to make |
| 638 | -- them into cross-project queries. Project saved queries always |
| 639 | -- implicitly execute in the context of a project. |
| 640 | CREATE TABLE SavedQueryExecutesInProject ( |
| 641 | query_id INT NOT NULL, |
| 642 | project_id SMALLINT UNSIGNED NOT NULL, |
| 643 | |
| 644 | PRIMARY KEY (query_id, project_id), |
| 645 | INDEX (project_id), |
| 646 | FOREIGN KEY (project_id) REFERENCES Project(project_id), |
| 647 | FOREIGN KEY (query_id) REFERENCES SavedQuery(id) |
| 648 | ) ENGINE=INNODB; |
| 649 | |
| 650 | |
| 651 | -- These are the queries edited by the project owner on the project |
| 652 | -- admin pages. |
| 653 | CREATE TABLE Project2SavedQuery ( |
| 654 | project_id SMALLINT UNSIGNED NOT NULL, |
| 655 | rank SMALLINT UNSIGNED NOT NULL, |
| 656 | query_id INT NOT NULL, |
| 657 | |
| 658 | -- TODO(jrobbins): visibility: owners, committers, contributors, anyone |
| 659 | |
| 660 | PRIMARY KEY (project_id, rank), |
| 661 | FOREIGN KEY (project_id) REFERENCES Project(project_id), |
| 662 | FOREIGN KEY (query_id) REFERENCES SavedQuery(id) |
| 663 | ) ENGINE=INNODB; |
| 664 | |
| 665 | |
| 666 | -- These are personal saved queries. |
| 667 | CREATE TABLE User2SavedQuery ( |
| 668 | user_id INT UNSIGNED NOT NULL, |
| 669 | rank SMALLINT UNSIGNED NOT NULL, |
| 670 | query_id INT NOT NULL, |
| 671 | |
| 672 | -- TODO(jrobbins): daily and weekly digests, and the ability to have |
| 673 | -- certain subscriptions go to username+SOMETHING@example.com. |
| 674 | subscription_mode ENUM ('noemail', 'immediate') DEFAULT 'noemail' NOT NULL, |
| 675 | |
| 676 | PRIMARY KEY (user_id, rank), |
| 677 | FOREIGN KEY (user_id) REFERENCES User(user_id), |
| 678 | FOREIGN KEY (query_id) REFERENCES SavedQuery(id) |
| 679 | ) ENGINE=INNODB; |
| 680 | |
| 681 | |
| 682 | -- Created whenever a user reports an issue or comment as spam. |
| 683 | -- Note this is distinct from a SpamVerdict, which is issued by |
| 684 | -- the system rather than a human user. |
| 685 | CREATE TABLE SpamReport ( |
| 686 | -- when this report was generated |
| 687 | created TIMESTAMP NOT NULL, |
| 688 | -- when the reported content was generated |
| 689 | -- TODO(jrobbins): needs default current_time in MySQL 5.7. |
| 690 | content_created TIMESTAMP NOT NULL, |
| 691 | -- id of the reporting user |
| 692 | user_id INT UNSIGNED NOT NULL, |
| 693 | -- id of the reported user |
| 694 | reported_user_id INT UNSIGNED NOT NULL, |
| 695 | -- either this or issue_id must be set |
| 696 | comment_id INT, |
| 697 | -- either this or comment_id must be set |
| 698 | issue_id INT, |
| 699 | |
| 700 | INDEX (issue_id), |
| 701 | INDEX (comment_id), |
| 702 | UNIQUE (user_id, comment_id, issue_id), |
| 703 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 704 | FOREIGN KEY (comment_id) REFERENCES Comment(id) |
| 705 | ) ENGINE=INNODB; |
| 706 | |
| 707 | |
| 708 | -- Any time a human or the system sets is_spam to true, |
| 709 | -- or changes it from true to false, we want to have a |
| 710 | -- record of who did it and why. |
| 711 | CREATE TABLE SpamVerdict ( |
| 712 | -- when this verdict was generated |
| 713 | created TIMESTAMP NOT NULL, |
| 714 | |
| 715 | -- id of the reporting user, may be null if it was |
| 716 | -- an automatic classification. |
| 717 | user_id INT UNSIGNED, |
| 718 | |
| 719 | -- id of the containing project. |
| 720 | project_id INT NOT NULL, |
| 721 | |
| 722 | -- either this or issue_id must be set. |
| 723 | comment_id INT, |
| 724 | |
| 725 | -- either this or comment_id must be set. |
| 726 | issue_id INT, |
| 727 | |
| 728 | -- If the classifier issued the verdict, this should be set. |
| 729 | classifier_confidence FLOAT, |
| 730 | |
| 731 | -- This should reflect the new is_spam value that was applied |
| 732 | -- by this verdict, not the value it had prior. |
| 733 | is_spam BOOLEAN NOT NULL, |
| 734 | |
| 735 | -- manual: a project owner marked it as spam. |
| 736 | -- threshhold: number of SpamReports from non-members was exceeded. |
| 737 | -- classifier: the automatic classifier reports it as spam. |
| 738 | -- fail_open: the classifier failed, resulting in a ham decision. |
| 739 | reason ENUM ("manual", "threshold", "classifier", "fail_open") NOT NULL, |
| 740 | |
| 741 | overruled BOOL NOT NULL, |
| 742 | |
| 743 | -- True indicates that the prediction service PRC failed and we gave up. |
| 744 | fail_open BOOL DEFAULT FALSE, |
| 745 | |
| 746 | INDEX (issue_id), |
| 747 | INDEX (comment_id), |
| 748 | INDEX (classifier_confidence), |
| 749 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 750 | FOREIGN KEY (comment_id) REFERENCES Comment(id) |
| 751 | |
| 752 | ) ENGINE=INNODB; |
| 753 | |
| 754 | |
| 755 | -- These are user-curated lists of issues which can be re-ordered to |
| 756 | -- prioritize work. |
| 757 | CREATE TABLE Hotlist ( |
| 758 | id INT UNSIGNED NOT NULL AUTO_INCREMENT, |
| 759 | name VARCHAR(80) NOT NULL, |
| 760 | |
| 761 | summary TEXT, |
| 762 | description TEXT, |
| 763 | |
| 764 | is_private BOOLEAN DEFAULT FALSE, |
| 765 | is_deleted BOOLEAN DEFAULT FALSE, |
| 766 | default_col_spec TEXT, |
| 767 | |
| 768 | PRIMARY KEY (id) |
| 769 | ) ENGINE=INNODB; |
| 770 | |
| 771 | |
| 772 | CREATE TABLE Hotlist2Issue ( |
| 773 | hotlist_id INT UNSIGNED NOT NULL, |
| 774 | issue_id INT NOT NULL, |
| 775 | |
| 776 | rank BIGINT NOT NULL, |
| 777 | adder_id INT UNSIGNED, |
| 778 | added INT, |
| 779 | note TEXT, |
| 780 | |
| 781 | PRIMARY KEY (hotlist_id, issue_id), |
| 782 | INDEX (hotlist_id), |
| 783 | INDEX (issue_id), |
| 784 | FOREIGN KEY (hotlist_id) REFERENCES Hotlist(id), |
| 785 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 786 | FOREIGN KEY (adder_id) REFERENCES User(user_id) |
| 787 | ) ENGINE=INNODB; |
| 788 | |
| 789 | |
| 790 | CREATE TABLE Hotlist2User ( |
| 791 | hotlist_id INT UNSIGNED NOT NULL, |
| 792 | user_id INT UNSIGNED NOT NULL, |
| 793 | |
| 794 | role_name ENUM ('owner', 'editor', 'follower') NOT NULL, |
| 795 | |
| 796 | PRIMARY KEY (hotlist_id, user_id), |
| 797 | INDEX (hotlist_id), |
| 798 | INDEX (user_id), |
| 799 | FOREIGN KEY (hotlist_id) REFERENCES Hotlist(id), |
| 800 | FOREIGN KEY (user_id) REFERENCES User(user_id) |
| 801 | ) ENGINE=INNODB; |
| 802 | |
| 803 | |
| 804 | CREATE TABLE HotlistStar ( |
| 805 | hotlist_id INT UNSIGNED NOT NULL, |
| 806 | user_id INT UNSIGNED NOT NULL, |
| 807 | |
| 808 | PRIMARY KEY (hotlist_id, user_id), |
| 809 | INDEX (user_id), |
| 810 | FOREIGN KEY (hotlist_id) REFERENCES Hotlist(id), |
| 811 | FOREIGN KEY (user_id) REFERENCES User(user_id) |
| 812 | ) ENGINE=INNODB; |
| 813 | |
| 814 | |
| 815 | CREATE TABLE HotlistVisitHistory ( |
| 816 | hotlist_id INT UNSIGNED NOT NULL, |
| 817 | user_id INT UNSIGNED NOT NULL, |
| 818 | viewed INT NOT NULL, |
| 819 | |
| 820 | PRIMARY KEY (user_id, hotlist_id), |
| 821 | FOREIGN KEY (hotlist_id) REFERENCES Hotlist(id), |
| 822 | FOREIGN KEY (user_id) REFERENCES User(user_id) |
| 823 | ) ENGINE=INNODB; |
| 824 | |
| 825 | |
| 826 | CREATE TABLE ComponentIssueClosedIndex ( |
| 827 | closed_index INT NOT NULL, |
| 828 | PRIMARY KEY (closed_index) |
| 829 | ) ENGINE=INNODB; |
| 830 | |
| 831 | |
| 832 | CREATE TABLE ApprovalDef2Approver ( |
| 833 | approval_id INT NOT NULL, |
| 834 | approver_id INT UNSIGNED NOT NULL, |
| 835 | project_id SMALLINT UNSIGNED NOT NULL, |
| 836 | |
| 837 | PRIMARY KEY (approval_id, approver_id), |
| 838 | |
| 839 | FOREIGN KEY (approval_id) REFERENCES FieldDef(id), |
| 840 | FOREIGN KEY (approver_id) REFERENCES User(user_id), |
| 841 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 842 | ) ENGINE=INNODB; |
| 843 | |
| 844 | |
| 845 | CREATE TABLE ApprovalDef2Survey ( |
| 846 | approval_id INT NOT NULL, |
| 847 | survey TEXT, |
| 848 | project_id SMALLINT UNSIGNED NOT NULL, |
| 849 | |
| 850 | PRIMARY KEY (approval_id), |
| 851 | |
| 852 | FOREIGN KEY (approval_id) REFERENCES FieldDef(id), |
| 853 | FOREIGN KEY (project_id) REFERENCES Project(project_id) |
| 854 | ) ENGINE=INNODB; |
| 855 | |
| 856 | CREATE TABLE Issue2ApprovalValue ( |
| 857 | issue_id INT NOT NULL, |
| 858 | approval_id INT NOT NULL, |
| 859 | phase_id INT, |
| 860 | status ENUM ('needs_review', 'na', 'review_requested', 'review_started', 'need_info', 'approved', 'not_approved', 'not_set') DEFAULT 'not_set' NOT NULL, |
| 861 | setter_id INT UNSIGNED, |
| 862 | set_on INT, |
| 863 | |
| 864 | PRIMARY KEY (issue_id, approval_id), |
| 865 | FOREIGN KEY (setter_id) REFERENCES User(user_id), |
| 866 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 867 | FOREIGN KEY (approval_id) REFERENCES FieldDef(id), |
| 868 | FOREIGN KEY (phase_id) REFERENCES IssuePhaseDef(id) |
| 869 | ) ENGINE=INNODB; |
| 870 | |
| 871 | |
| 872 | CREATE TABLE IssueApproval2Approver ( |
| 873 | issue_id INT NOT NULL, |
| 874 | approval_id INT NOT NULL, |
| 875 | approver_id INT UNSIGNED NOT NULL, |
| 876 | |
| 877 | PRIMARY KEY (issue_id, approval_id, approver_id), |
| 878 | FOREIGN KEY (issue_id) REFERENCES Issue(id), |
| 879 | FOREIGN KEY (approval_id) REFERENCES FieldDef(id), |
| 880 | FOREIGN KEY (approver_id) REFERENCES User(user_id) |
| 881 | ) ENGINE=INNODB; |
| 882 | |
| 883 | |
| 884 | CREATE TABLE IssueApproval2Comment ( |
| 885 | approval_id INT NOT NULL, |
| 886 | comment_id INT NOT NULL, |
| 887 | |
| 888 | PRIMARY KEY (comment_id), |
| 889 | INDEX (approval_id), |
| 890 | FOREIGN KEY (approval_id) REFERENCES FieldDef(id), |
| 891 | FOREIGN KEY (comment_id) REFERENCES Comment(id) |
| 892 | ) ENGINE=INNODB; |
| 893 | |
| 894 | |
| 895 | CREATE TABLE IssueSnapshot ( |
| 896 | id INT NOT NULL AUTO_INCREMENT, |
| 897 | issue_id INT NOT NULL, |
| 898 | shard SMALLINT UNSIGNED DEFAULT 0 NOT NULL, |
| 899 | project_id SMALLINT UNSIGNED NOT NULL, |
| 900 | local_id INT NOT NULL, |
| 901 | reporter_id INT UNSIGNED NOT NULL, |
| 902 | owner_id INT UNSIGNED, |
| 903 | status_id INT, |
| 904 | period_start INT UNSIGNED NOT NULL, |
| 905 | period_end INT UNSIGNED NOT NULL, |
| 906 | is_open BOOLEAN DEFAULT TRUE, |
| 907 | |
| 908 | PRIMARY KEY (id), |
| 909 | FOREIGN KEY (project_id) REFERENCES Project(project_id), |
| 910 | FOREIGN KEY (reporter_id) REFERENCES User(user_id), |
| 911 | FOREIGN KEY (owner_id) REFERENCES User(user_id), |
| 912 | FOREIGN KEY (status_id) REFERENCES StatusDef(id), |
| 913 | INDEX (shard, project_id, period_start, period_end), |
| 914 | INDEX by_period_start (shard, project_id, status_id, period_start), |
| 915 | INDEX by_period_end (shard, project_id, status_id, period_end), |
| 916 | KEY (issue_id, period_start, period_end) |
| 917 | ) ENGINE=INNODB; |
| 918 | |
| 919 | |
| 920 | CREATE TABLE IssueSnapshot2Component ( |
| 921 | issuesnapshot_id INT NOT NULL, |
| 922 | component_id INT NOT NULL, |
| 923 | |
| 924 | PRIMARY KEY (issuesnapshot_id, component_id), |
| 925 | FOREIGN KEY (issuesnapshot_id) REFERENCES IssueSnapshot(id), |
| 926 | FOREIGN KEY (component_id) REFERENCES ComponentDef(id) |
| 927 | ) ENGINE=INNODB; |
| 928 | |
| 929 | |
| 930 | CREATE TABLE IssueSnapshot2Label( |
| 931 | issuesnapshot_id INT NOT NULL, |
| 932 | label_id INT NOT NULL, |
| 933 | |
| 934 | PRIMARY KEY (issuesnapshot_id, label_id), |
| 935 | FOREIGN KEY (issuesnapshot_id) REFERENCES IssueSnapshot(id), |
| 936 | FOREIGN KEY (label_id) REFERENCES LabelDef(id) |
| 937 | ) ENGINE=INNODB; |
| 938 | |
| 939 | |
| 940 | CREATE TABLE IssueSnapshot2Cc( |
| 941 | issuesnapshot_id INT NOT NULL, |
| 942 | cc_id INT UNSIGNED NOT NULL, |
| 943 | |
| 944 | PRIMARY KEY (issuesnapshot_id, cc_id), |
| 945 | FOREIGN KEY (issuesnapshot_id) REFERENCES IssueSnapshot(id), |
| 946 | FOREIGN KEY (cc_id) REFERENCES User(user_id) |
| 947 | ) ENGINE=INNODB; |
| 948 | |
| 949 | |
| 950 | CREATE TABLE IssueSnapshot2Hotlist( |
| 951 | issuesnapshot_id INT NOT NULL, |
| 952 | hotlist_id INT UNSIGNED NOT NULL, |
| 953 | |
| 954 | PRIMARY KEY (issuesnapshot_id, hotlist_id), |
| 955 | FOREIGN KEY (issuesnapshot_id) REFERENCES IssueSnapshot(id), |
| 956 | FOREIGN KEY (hotlist_id) REFERENCES Hotlist(id) |
| 957 | ) ENGINE=INNODB; |