2 -- Created by SQL::Translator::Producer::PostgreSQL
3 -- Created on Fri Apr 14 20:22:11 2017
13 CONSTRAINT "arch_arch_key" UNIQUE ("arch")
20 CREATE TABLE "bin_pkg" (
24 CONSTRAINT "bin_pkg_pkg_key" UNIQUE ("pkg")
29 -- Table: column_comments
31 CREATE TABLE "column_comments" (
32 "table_name" text NOT NULL,
33 "column_name" text NOT NULL,
34 "comment_text" text NOT NULL,
35 CONSTRAINT "column_comments_table_name_column_name_idx" UNIQUE ("table_name", "column_name")
40 -- Table: correspondent
42 CREATE TABLE "correspondent" (
46 CONSTRAINT "correspondent_addr_idx" UNIQUE ("addr")
53 CREATE TABLE "message" (
55 "msgid" text DEFAULT '' NOT NULL,
56 "from_complete" text DEFAULT '' NOT NULL,
57 "to_complete" text DEFAULT '' NOT NULL,
58 "subject" text DEFAULT '' NOT NULL,
59 "sent_date" timestamp with time zone,
60 "refs" text DEFAULT '' NOT NULL,
61 "spam_score" double precision DEFAULT '0' NOT NULL,
62 "is_spam" boolean DEFAULT false NOT NULL,
64 CONSTRAINT "message_msgid_from_complete_to_complete_subject_idx" UNIQUE ("msgid", "from_complete", "to_complete", "subject")
66 CREATE INDEX "message_msgid_idx" on "message" ("msgid");
67 CREATE INDEX "message_subject_idx" on "message" ("subject");
73 CREATE TABLE "severity" (
75 "severity" text NOT NULL,
76 "ordering" integer DEFAULT 5 NOT NULL,
77 "strong" boolean DEFAULT false,
78 "obsolete" boolean DEFAULT false,
80 CONSTRAINT "severity_severity_idx" UNIQUE ("severity")
82 CREATE INDEX "severity_ordering_idx" on "severity" ("ordering");
88 CREATE TABLE "src_pkg" (
91 "pseduopkg" boolean DEFAULT false NOT NULL,
93 "creation" timestamp with time zone DEFAULT current_timestamp NOT NULL,
94 "disabled" timestamp with time zone DEFAULT 'infinity' NOT NULL,
95 "last_modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
96 "obsolete" boolean DEFAULT false NOT NULL,
98 CONSTRAINT "src_pkg_pkg_disabled" UNIQUE ("pkg", "disabled")
100 CREATE INDEX "src_pkg_idx_alias_of" on "src_pkg" ("alias_of");
101 CREATE INDEX "src_pkg_pkg" on "src_pkg" ("pkg");
107 CREATE TABLE "suite" (
108 "id" serial NOT NULL,
109 "codename" text NOT NULL,
112 "active" boolean DEFAULT true,
114 CONSTRAINT "suite_idx_codename" UNIQUE ("codename"),
115 CONSTRAINT "suite_idx_version" UNIQUE ("version"),
116 CONSTRAINT "suite_suite_name_key" UNIQUE ("suite_name")
121 -- Table: table_comments
123 CREATE TABLE "table_comments" (
124 "table_name" text NOT NULL,
125 "comment_text" text NOT NULL,
126 CONSTRAINT "table_comments_table_name_idx" UNIQUE ("table_name"),
127 CONSTRAINT "table_comments_table_name_key" UNIQUE ("table_name")
135 "id" serial NOT NULL,
137 "obsolete" boolean DEFAULT false,
139 CONSTRAINT "tag_tag_key" UNIQUE ("tag")
144 -- Table: correspondent_full_name
146 CREATE TABLE "correspondent_full_name" (
147 "correspondent" integer NOT NULL,
148 "full_name" text NOT NULL,
149 "last_seen" timestamp DEFAULT current_timestamp NOT NULL,
150 CONSTRAINT "correspondent_full_name_correspondent_full_name_idx" UNIQUE ("correspondent", "full_name")
152 CREATE INDEX "correspondent_full_name_idx_correspondent" on "correspondent_full_name" ("correspondent");
153 CREATE INDEX "message_correspondent_idxcorrespondent" on "correspondent_full_name" ("correspondent");
154 CREATE INDEX "message_correspondent_idxmessage" on "correspondent_full_name" ("message");
160 CREATE TABLE "maintainer" (
161 "id" serial NOT NULL,
162 "name" text NOT NULL,
163 "correspondent" integer NOT NULL,
164 "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
165 "modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
167 CONSTRAINT "maintainer_name_idx" UNIQUE ("name")
169 CREATE INDEX "maintainer_idx_correspondent" on "maintainer" ("correspondent");
173 -- Table: message_refs
175 CREATE TABLE "message_refs" (
176 "message" integer NOT NULL,
177 "refs" integer NOT NULL,
178 "inferred" boolean DEFAULT false,
179 "primary_ref" boolean DEFAULT false,
180 CONSTRAINT "message_refs_message_refs_idx" UNIQUE ("message", "refs")
182 CREATE INDEX "message_refs_idx_message" on "message_refs" ("message");
183 CREATE INDEX "message_refs_idx_refs" on "message_refs" ("refs");
189 CREATE TABLE "user_tag" (
190 "id" serial NOT NULL,
192 "correspondent" integer NOT NULL,
194 CONSTRAINT "user_tag_tag_correspondent" UNIQUE ("tag", "correspondent")
196 CREATE INDEX "user_tag_idx_correspondent" on "user_tag" ("correspondent");
197 CREATE INDEX "user_tag_correspondent" on "user_tag" ("correspondent");
204 "id" integer NOT NULL,
205 "creation" timestamp with time zone DEFAULT current_timestamp NOT NULL,
206 "log_modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
207 "last_modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
208 "archived" boolean DEFAULT false NOT NULL,
209 "unarchived" timestamp with time zone,
210 "forwarded" text DEFAULT '' NOT NULL,
211 "summary" text DEFAULT '' NOT NULL,
212 "outlook" text DEFAULT '' NOT NULL,
213 "subject" text NOT NULL,
214 "severity" integer NOT NULL,
216 "done_full" text DEFAULT '' NOT NULL,
218 "owner_full" text DEFAULT '' NOT NULL,
220 "submitter_full" text DEFAULT '' NOT NULL,
221 "unknown_packages" text DEFAULT '' NOT NULL,
224 CREATE INDEX "bug_idx_done" on "bug" ("done");
225 CREATE INDEX "bug_idx_owner" on "bug" ("owner");
226 CREATE INDEX "bug_idx_severity" on "bug" ("severity");
227 CREATE INDEX "bug_idx_submitter" on "bug" ("submitter");
228 CREATE INDEX "bug_idxowner" on "bug" ("owner");
229 CREATE INDEX "bug_idxsubmitter" on "bug" ("submitter");
230 CREATE INDEX "bug_idxdone" on "bug" ("done");
231 CREATE INDEX "bug_idxforwarded" on "bug" ("forwarded");
232 CREATE INDEX "bug_idxlast_modified" on "bug" ("last_modified");
233 CREATE INDEX "bug_idxseverity" on "bug" ("severity");
234 CREATE INDEX "bug_idxcreation" on "bug" ("creation");
235 CREATE INDEX "bug_idxlog_modified" on "bug" ("log_modified");
239 -- Table: message_correspondent
241 CREATE TABLE "message_correspondent" (
242 "message" integer NOT NULL,
243 "correspondent" integer NOT NULL,
244 "correspondent_type" character varying DEFAULT 'to' NOT NULL,
245 CONSTRAINT "message_correspondent_message_correspondent_correspondent_t_idx" UNIQUE ("message", "correspondent", "correspondent_type")
247 CREATE INDEX "message_correspondent_idx_correspondent" on "message_correspondent" ("correspondent");
248 CREATE INDEX "message_correspondent_idx_message" on "message_correspondent" ("message");
254 CREATE TABLE "bug_blocks" (
255 "id" serial NOT NULL,
256 "bug" integer NOT NULL,
257 "blocks" integer NOT NULL,
259 CONSTRAINT "bug_blocks_bug_id_blocks_idx" UNIQUE ("bug", "blocks")
261 CREATE INDEX "bug_blocks_idx_blocks" on "bug_blocks" ("blocks");
262 CREATE INDEX "bug_blocks_idx_bug" on "bug_blocks" ("bug");
263 CREATE INDEX "bug_blocks_bug_idx" on "bug_blocks" ("bug");
264 CREATE INDEX "bug_blocks_blocks_idx" on "bug_blocks" ("blocks");
270 CREATE TABLE "bug_merged" (
271 "id" serial NOT NULL,
272 "bug" integer NOT NULL,
273 "merged" integer NOT NULL,
275 CONSTRAINT "bug_merged_bug_id_merged_idx" UNIQUE ("bug", "merged")
277 CREATE INDEX "bug_merged_idx_bug" on "bug_merged" ("bug");
278 CREATE INDEX "bug_merged_idx_merged" on "bug_merged" ("merged");
279 CREATE INDEX "bug_merged_bug_idx" on "bug_merged" ("bug");
280 CREATE INDEX "bug_merged_merged_idx" on "bug_merged" ("merged");
286 CREATE TABLE "src_ver" (
287 "id" serial NOT NULL,
288 "src_pkg" integer NOT NULL,
289 "ver" debversion NOT NULL,
290 "maintainer" integer,
291 "upload_date" timestamp with time zone DEFAULT current_timestamp NOT NULL,
294 CONSTRAINT "src_ver_src_pkg_id_ver" UNIQUE ("src_pkg", "ver")
296 CREATE INDEX "src_ver_idx_based_on" on "src_ver" ("based_on");
297 CREATE INDEX "src_ver_idx_maintainer" on "src_ver" ("maintainer");
298 CREATE INDEX "src_ver_idx_src_pkg" on "src_ver" ("src_pkg");
302 -- Table: bug_affects_binpackage
304 CREATE TABLE "bug_affects_binpackage" (
305 "bug" integer NOT NULL,
306 "bin_pkg" integer NOT NULL,
307 CONSTRAINT "bug_affects_binpackage_id_pkg" UNIQUE ("bug", "bin_pkg")
309 CREATE INDEX "bug_affects_binpackage_idx_bin_pkg" on "bug_affects_binpackage" ("bin_pkg");
310 CREATE INDEX "bug_affects_binpackage_idx_bug" on "bug_affects_binpackage" ("bug");
314 -- Table: bug_affects_srcpackage
316 CREATE TABLE "bug_affects_srcpackage" (
317 "bug" integer NOT NULL,
318 "src_pkg" integer NOT NULL,
319 CONSTRAINT "bug_affects_srcpackage_id_pkg" UNIQUE ("bug", "src_pkg")
321 CREATE INDEX "bug_affects_srcpackage_idx_bug" on "bug_affects_srcpackage" ("bug");
322 CREATE INDEX "bug_affects_srcpackage_idx_src_pkg" on "bug_affects_srcpackage" ("src_pkg");
326 -- Table: bug_binpackage
328 CREATE TABLE "bug_binpackage" (
329 "bug" integer NOT NULL,
330 "bin_pkg" integer NOT NULL,
331 CONSTRAINT "bug_binpackage_id_pkg" UNIQUE ("bug", "bin_pkg")
333 CREATE INDEX "bug_binpackage_idx_bin_pkg" on "bug_binpackage" ("bin_pkg");
334 CREATE INDEX "bug_binpackage_idx_bug" on "bug_binpackage" ("bug");
335 CREATE INDEX "bug_binpackage_bin_pkg_idx" on "bug_binpackage" ("bin_pkg");
339 -- Table: bug_message
341 CREATE TABLE "bug_message" (
342 "bug" integer NOT NULL,
343 "message" integer NOT NULL,
344 "message_number" integer NOT NULL,
345 "bug_log_offset" integer,
346 "offset_valid" timestamp with time zone,
347 CONSTRAINT "bug_message_bug_message_idx" UNIQUE ("bug", "message")
349 CREATE INDEX "bug_message_idx_bug" on "bug_message" ("bug");
350 CREATE INDEX "bug_message_idx_message" on "bug_message" ("message");
351 CREATE INDEX "bug_message_idx_bug_message_number" on "bug_message" ("bug", "message_number");
355 -- Table: bug_srcpackage
357 CREATE TABLE "bug_srcpackage" (
358 "bug" integer NOT NULL,
359 "src_pkg" integer NOT NULL,
360 CONSTRAINT "bug_srcpackage_id_pkg" UNIQUE ("bug", "src_pkg")
362 CREATE INDEX "bug_srcpackage_idx_bug" on "bug_srcpackage" ("bug");
363 CREATE INDEX "bug_srcpackage_idx_src_pkg" on "bug_srcpackage" ("src_pkg");
364 CREATE INDEX "bug_srcpackage_src_pkg_idx" on "bug_srcpackage" ("src_pkg");
370 CREATE TABLE "bug_tag" (
371 "bug" integer NOT NULL,
372 "tag" integer NOT NULL,
373 CONSTRAINT "bug_tag_bug_tag" UNIQUE ("bug", "tag")
375 CREATE INDEX "bug_tag_idx_bug" on "bug_tag" ("bug");
376 CREATE INDEX "bug_tag_idx_tag" on "bug_tag" ("tag");
377 CREATE INDEX "bug_tag_tag" on "bug_tag" ("tag");
381 -- Table: bug_user_tag
383 CREATE TABLE "bug_user_tag" (
384 "bug" integer NOT NULL,
385 "user_tag" integer NOT NULL,
386 CONSTRAINT "bug_user_tag_bug_tag" UNIQUE ("bug", "user_tag")
388 CREATE INDEX "bug_user_tag_idx_bug" on "bug_user_tag" ("bug");
389 CREATE INDEX "bug_user_tag_idx_user_tag" on "bug_user_tag" ("user_tag");
390 CREATE INDEX "bug_user_tag_tag" on "bug_user_tag" ("user_tag");
394 -- Table: bug_status_cache
396 CREATE TABLE "bug_status_cache" (
397 "bug" integer NOT NULL,
400 "status" character varying NOT NULL,
401 "modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
402 "asof" timestamp with time zone DEFAULT current_timestamp NOT NULL,
403 CONSTRAINT "bug_status_cache_bug_suite_arch_idx" UNIQUE ("bug", "suite", "arch")
405 CREATE INDEX "bug_status_cache_idx_arch" on "bug_status_cache" ("arch");
406 CREATE INDEX "bug_status_cache_idx_bug" on "bug_status_cache" ("bug");
407 CREATE INDEX "bug_status_cache_idx_suite" on "bug_status_cache" ("suite");
411 -- Table: src_associations
413 CREATE TABLE "src_associations" (
414 "id" serial NOT NULL,
415 "suite" integer NOT NULL,
416 "source" integer NOT NULL,
417 "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
418 "modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
420 CONSTRAINT "src_associations_source_suite" UNIQUE ("source", "suite")
422 CREATE INDEX "src_associations_idx_source" on "src_associations" ("source");
423 CREATE INDEX "src_associations_idx_suite" on "src_associations" ("suite");
429 CREATE TABLE "bin_ver" (
430 "id" serial NOT NULL,
431 "bin_pkg" integer NOT NULL,
432 "src_ver" integer NOT NULL,
433 "arch" integer NOT NULL,
434 "ver" debversion NOT NULL,
436 CONSTRAINT "bin_ver_bin_pkg_id_arch_idx" UNIQUE ("bin_pkg", "arch", "ver")
438 CREATE INDEX "bin_ver_idx_arch" on "bin_ver" ("arch");
439 CREATE INDEX "bin_ver_idx_bin_pkg" on "bin_ver" ("bin_pkg");
440 CREATE INDEX "bin_ver_idx_src_ver" on "bin_ver" ("src_ver");
441 CREATE INDEX "bin_ver_ver_id_idx" on "bin_ver" ("ver");
442 CREATE INDEX "bin_ver_bin_pkg_id_idx" on "bin_ver" ("bin_pkg");
443 CREATE INDEX "bin_ver_src_ver_id_idx" on "bin_ver" ("src_ver");
444 CREATE INDEX "bin_ver_src_ver_id_arch_idx" on "bin_ver" ("src_ver", "arch");
450 CREATE TABLE "bug_ver" (
451 "id" serial NOT NULL,
452 "bug" integer NOT NULL,
456 "found" boolean DEFAULT true NOT NULL,
457 "creation" timestamp with time zone DEFAULT current_timestamp NOT NULL,
458 "last_modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
460 CONSTRAINT "bug_ver_bug_ver_string_found_idx" UNIQUE ("bug", "ver_string", "found")
462 CREATE INDEX "bug_ver_idx_bug" on "bug_ver" ("bug");
463 CREATE INDEX "bug_ver_idx_src_pkg" on "bug_ver" ("src_pkg");
464 CREATE INDEX "bug_ver_idx_src_ver" on "bug_ver" ("src_ver");
465 CREATE INDEX "bug_ver_src_pkg_id_idx" on "bug_ver" ("src_pkg");
466 CREATE INDEX "bug_ver_src_ver_id_idx" on "bug_ver" ("src_ver");
467 CREATE INDEX "bug_ver_src_pkg_id_src_ver_id_idx" on "bug_ver" ("src_pkg", "src_ver");
471 -- Table: bin_associations
473 CREATE TABLE "bin_associations" (
474 "id" serial NOT NULL,
475 "suite" integer NOT NULL,
476 "bin" integer NOT NULL,
477 "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
478 "modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
480 CONSTRAINT "bin_associations_bin_suite" UNIQUE ("bin", "suite")
482 CREATE INDEX "bin_associations_idx_bin" on "bin_associations" ("bin");
483 CREATE INDEX "bin_associations_idx_suite" on "bin_associations" ("suite");
487 -- View: "binary_versions"
489 CREATE VIEW "binary_versions" ( "src_pkg", "src_ver", "bin_pkg", "arch", "bin_ver", "src_ver_based_on", "src_pkg_based_on" ) AS
490 SELECT sp.pkg AS src_pkg, sv.ver AS src_ver, bp.pkg AS bin_pkg, a.arch AS arch, b.ver AS bin_ver,
491 svb.ver AS src_ver_based_on, spb.pkg AS src_pkg_based_on
492 FROM bin_ver b JOIN arch a ON b.arch = a.id
493 JOIN bin_pkg bp ON b.bin_pkg = bp.id
494 JOIN src_ver sv ON b.src_ver = sv.id
495 JOIN src_pkg sp ON sv.src_pkg = sp.id
496 LEFT OUTER JOIN src_ver svb ON sv.based_on = svb.id
497 LEFT OUTER JOIN src_pkg spb ON spb.id = svb.src_pkg;
503 -- View: "bug_package"
505 CREATE VIEW "bug_package" ( "bug", "pkg_id", "pkg_type", "package" ) AS
506 SELECT b.bug,b.bin_pkg,'binary',bp.pkg FROM bug_binpackage b JOIN bin_pkg bp ON bp.id=b.bin_pkg UNION
507 SELECT s.bug,s.src_pkg,'source',sp.pkg FROM bug_srcpackage s JOIN src_pkg sp ON sp.id=s.src_pkg;
513 -- Foreign Key Definitions
517 ALTER TABLE "src_pkg" ADD CONSTRAINT "src_pkg_fk_alias_of" FOREIGN KEY ("alias_of")
518 REFERENCES "src_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
521 ALTER TABLE "correspondent_full_name" ADD CONSTRAINT "correspondent_full_name_fk_correspondent" FOREIGN KEY ("correspondent")
522 REFERENCES "correspondent" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
525 ALTER TABLE "maintainer" ADD CONSTRAINT "maintainer_fk_correspondent" FOREIGN KEY ("correspondent")
526 REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
529 ALTER TABLE "message_refs" ADD CONSTRAINT "message_refs_fk_message" FOREIGN KEY ("message")
530 REFERENCES "message" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
533 ALTER TABLE "message_refs" ADD CONSTRAINT "message_refs_fk_refs" FOREIGN KEY ("refs")
534 REFERENCES "message" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
537 ALTER TABLE "user_tag" ADD CONSTRAINT "user_tag_fk_correspondent" FOREIGN KEY ("correspondent")
538 REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
541 ALTER TABLE "bug" ADD CONSTRAINT "bug_fk_done" FOREIGN KEY ("done")
542 REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
545 ALTER TABLE "bug" ADD CONSTRAINT "bug_fk_owner" FOREIGN KEY ("owner")
546 REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
549 ALTER TABLE "bug" ADD CONSTRAINT "bug_fk_severity" FOREIGN KEY ("severity")
550 REFERENCES "severity" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
553 ALTER TABLE "bug" ADD CONSTRAINT "bug_fk_submitter" FOREIGN KEY ("submitter")
554 REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
557 ALTER TABLE "message_correspondent" ADD CONSTRAINT "message_correspondent_fk_correspondent" FOREIGN KEY ("correspondent")
558 REFERENCES "correspondent" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
561 ALTER TABLE "message_correspondent" ADD CONSTRAINT "message_correspondent_fk_message" FOREIGN KEY ("message")
562 REFERENCES "message" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
565 ALTER TABLE "bug_blocks" ADD CONSTRAINT "bug_blocks_fk_blocks" FOREIGN KEY ("blocks")
566 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
569 ALTER TABLE "bug_blocks" ADD CONSTRAINT "bug_blocks_fk_bug" FOREIGN KEY ("bug")
570 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
573 ALTER TABLE "bug_merged" ADD CONSTRAINT "bug_merged_fk_bug" FOREIGN KEY ("bug")
574 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
577 ALTER TABLE "bug_merged" ADD CONSTRAINT "bug_merged_fk_merged" FOREIGN KEY ("merged")
578 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
581 ALTER TABLE "src_ver" ADD CONSTRAINT "src_ver_fk_based_on" FOREIGN KEY ("based_on")
582 REFERENCES "src_ver" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
585 ALTER TABLE "src_ver" ADD CONSTRAINT "src_ver_fk_maintainer" FOREIGN KEY ("maintainer")
586 REFERENCES "maintainer" ("id") ON DELETE SET NULL ON UPDATE CASCADE;
589 ALTER TABLE "src_ver" ADD CONSTRAINT "src_ver_fk_src_pkg" FOREIGN KEY ("src_pkg")
590 REFERENCES "src_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
593 ALTER TABLE "bug_affects_binpackage" ADD CONSTRAINT "bug_affects_binpackage_fk_bin_pkg" FOREIGN KEY ("bin_pkg")
594 REFERENCES "bin_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
597 ALTER TABLE "bug_affects_binpackage" ADD CONSTRAINT "bug_affects_binpackage_fk_bug" FOREIGN KEY ("bug")
598 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
601 ALTER TABLE "bug_affects_srcpackage" ADD CONSTRAINT "bug_affects_srcpackage_fk_bug" FOREIGN KEY ("bug")
602 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
605 ALTER TABLE "bug_affects_srcpackage" ADD CONSTRAINT "bug_affects_srcpackage_fk_src_pkg" FOREIGN KEY ("src_pkg")
606 REFERENCES "src_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
609 ALTER TABLE "bug_binpackage" ADD CONSTRAINT "bug_binpackage_fk_bin_pkg" FOREIGN KEY ("bin_pkg")
610 REFERENCES "bin_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
613 ALTER TABLE "bug_binpackage" ADD CONSTRAINT "bug_binpackage_fk_bug" FOREIGN KEY ("bug")
614 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
617 ALTER TABLE "bug_message" ADD CONSTRAINT "bug_message_fk_bug" FOREIGN KEY ("bug")
618 REFERENCES "bug" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
621 ALTER TABLE "bug_message" ADD CONSTRAINT "bug_message_fk_message" FOREIGN KEY ("message")
622 REFERENCES "message" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
625 ALTER TABLE "bug_srcpackage" ADD CONSTRAINT "bug_srcpackage_fk_bug" FOREIGN KEY ("bug")
626 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
629 ALTER TABLE "bug_srcpackage" ADD CONSTRAINT "bug_srcpackage_fk_src_pkg" FOREIGN KEY ("src_pkg")
630 REFERENCES "src_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
633 ALTER TABLE "bug_tag" ADD CONSTRAINT "bug_tag_fk_bug" FOREIGN KEY ("bug")
634 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
637 ALTER TABLE "bug_tag" ADD CONSTRAINT "bug_tag_fk_tag" FOREIGN KEY ("tag")
638 REFERENCES "tag" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
641 ALTER TABLE "bug_user_tag" ADD CONSTRAINT "bug_user_tag_fk_bug" FOREIGN KEY ("bug")
642 REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
645 ALTER TABLE "bug_user_tag" ADD CONSTRAINT "bug_user_tag_fk_user_tag" FOREIGN KEY ("user_tag")
646 REFERENCES "user_tag" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
649 ALTER TABLE "bug_status_cache" ADD CONSTRAINT "bug_status_cache_fk_arch" FOREIGN KEY ("arch")
650 REFERENCES "arch" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
653 ALTER TABLE "bug_status_cache" ADD CONSTRAINT "bug_status_cache_fk_bug" FOREIGN KEY ("bug")
654 REFERENCES "bug" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
657 ALTER TABLE "bug_status_cache" ADD CONSTRAINT "bug_status_cache_fk_suite" FOREIGN KEY ("suite")
658 REFERENCES "suite" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
661 ALTER TABLE "src_associations" ADD CONSTRAINT "src_associations_fk_source" FOREIGN KEY ("source")
662 REFERENCES "src_ver" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
665 ALTER TABLE "src_associations" ADD CONSTRAINT "src_associations_fk_suite" FOREIGN KEY ("suite")
666 REFERENCES "suite" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
669 ALTER TABLE "bin_ver" ADD CONSTRAINT "bin_ver_fk_arch" FOREIGN KEY ("arch")
670 REFERENCES "arch" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
673 ALTER TABLE "bin_ver" ADD CONSTRAINT "bin_ver_fk_bin_pkg" FOREIGN KEY ("bin_pkg")
674 REFERENCES "bin_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
677 ALTER TABLE "bin_ver" ADD CONSTRAINT "bin_ver_fk_src_ver" FOREIGN KEY ("src_ver")
678 REFERENCES "src_ver" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
681 ALTER TABLE "bug_ver" ADD CONSTRAINT "bug_ver_fk_bug" FOREIGN KEY ("bug")
682 REFERENCES "bug" ("id") ON DELETE RESTRICT ON UPDATE CASCADE;
685 ALTER TABLE "bug_ver" ADD CONSTRAINT "bug_ver_fk_src_pkg" FOREIGN KEY ("src_pkg")
686 REFERENCES "src_pkg" ("id") ON DELETE SET NULL ON UPDATE CASCADE;
689 ALTER TABLE "bug_ver" ADD CONSTRAINT "bug_ver_fk_src_ver" FOREIGN KEY ("src_ver")
690 REFERENCES "src_ver" ("id") ON DELETE SET NULL ON UPDATE CASCADE;
693 ALTER TABLE "bin_associations" ADD CONSTRAINT "bin_associations_fk_bin" FOREIGN KEY ("bin")
694 REFERENCES "bin_ver" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
697 ALTER TABLE "bin_associations" ADD CONSTRAINT "bin_associations_fk_suite" FOREIGN KEY ("suite")
698 REFERENCES "suite" ("id") ON DELETE CASCADE ON UPDATE CASCADE;