]> git.donarmstrong.com Git - debbugs.git/blob - sql/PostgreSQL/deploy/1/001-auto.sql
we should not include DBIx::ClassDeploymentHandlerVersion as a table in its own right
[debbugs.git] / sql / PostgreSQL / deploy / 1 / 001-auto.sql
1 -- 
2 -- Created by SQL::Translator::Producer::PostgreSQL
3 -- Created on Wed Aug  6 14:09:26 2014
4 -- 
5 ;
6 --
7 -- Table: arch.
8 --
9 CREATE TABLE "arch" (
10   "id" serial NOT NULL,
11   "arch" text NOT NULL,
12   PRIMARY KEY ("id"),
13   CONSTRAINT "arch_arch_key" UNIQUE ("arch")
14 );
15
16 ;
17 --
18 -- Table: bin_pkg.
19 --
20 CREATE TABLE "bin_pkg" (
21   "id" serial NOT NULL,
22   "pkg" text NOT NULL,
23   PRIMARY KEY ("id"),
24   CONSTRAINT "bin_pkg_pkg_key" UNIQUE ("pkg")
25 );
26
27 ;
28 --
29 -- Table: binary_versions.
30 --
31 CREATE TABLE "binary_versions" (
32   "src_pkg" text,
33   "src_ver" debversion,
34   "bin_pkg" text,
35   "arch" text,
36   "bin_ver" debversion,
37   "src_ver_based_on" debversion,
38   "src_pkg_based_on" text
39 );
40
41 ;
42 --
43 -- Table: bug_package.
44 --
45 CREATE TABLE "bug_package" (
46   "bug" integer,
47   "pkg_id" integer,
48   "pkg_type" text,
49   "package" text
50 );
51
52 ;
53 --
54 -- Table: column_comments.
55 --
56 CREATE TABLE "column_comments" (
57   "table_name" text NOT NULL,
58   "column_name" text NOT NULL,
59   "comment_text" text NOT NULL,
60   CONSTRAINT "column_comments_table_name_column_name_idx" UNIQUE ("table_name", "column_name")
61 );
62
63 ;
64 --
65 -- Table: correspondent.
66 --
67 CREATE TABLE "correspondent" (
68   "id" serial NOT NULL,
69   "addr" text NOT NULL,
70   PRIMARY KEY ("id"),
71   CONSTRAINT "correspondent_addr_idx" UNIQUE ("addr")
72 );
73
74 ;
75 --
76 -- Table: message.
77 --
78 CREATE TABLE "message" (
79   "id" serial NOT NULL,
80   "msgid" text,
81   "from_complete" text,
82   "from_addr" text,
83   "to_complete" text,
84   "to_addr" text,
85   "subject" text DEFAULT '' NOT NULL,
86   "sent_date" timestamp with time zone,
87   "refs" text DEFAULT '' NOT NULL,
88   "spam_score" double precision,
89   "is_spam" boolean DEFAULT false,
90   PRIMARY KEY ("id")
91 );
92
93 ;
94 --
95 -- Table: severity.
96 --
97 CREATE TABLE "severity" (
98   "id" serial NOT NULL,
99   "severity" text NOT NULL,
100   "ordering" integer DEFAULT 5 NOT NULL,
101   "strong" boolean DEFAULT false,
102   "obsolete" boolean DEFAULT false,
103   PRIMARY KEY ("id"),
104   CONSTRAINT "severity_severity_idx" UNIQUE ("severity")
105 );
106
107 ;
108 --
109 -- Table: src_pkg.
110 --
111 CREATE TABLE "src_pkg" (
112   "id" serial NOT NULL,
113   "pkg" text NOT NULL,
114   "pseduopkg" boolean DEFAULT false,
115   "alias_of" integer,
116   "creation" timestamp with time zone DEFAULT current_timestamp,
117   "disabled" timestamp with time zone,
118   "last_modified" timestamp with time zone DEFAULT current_timestamp,
119   "obsolete" boolean DEFAULT false,
120   PRIMARY KEY ("id"),
121   CONSTRAINT "src_pkg_pkg_disabled" UNIQUE ("pkg", "disabled")
122 );
123 CREATE INDEX "src_pkg_idx_alias_of" on "src_pkg" ("alias_of");
124
125 ;
126 --
127 -- Table: suite.
128 --
129 CREATE TABLE "suite" (
130   "id" serial NOT NULL,
131   "suite_name" text NOT NULL,
132   "version" text,
133   "codename" text,
134   "active" boolean DEFAULT true,
135   PRIMARY KEY ("id"),
136   CONSTRAINT "suite_suite_name_key" UNIQUE ("suite_name")
137 );
138
139 ;
140 --
141 -- Table: table_comments.
142 --
143 CREATE TABLE "table_comments" (
144   "table_name" text NOT NULL,
145   "comment_text" text NOT NULL,
146   CONSTRAINT "table_comments_table_name_key" UNIQUE ("table_name")
147 );
148
149 ;
150 --
151 -- Table: tag.
152 --
153 CREATE TABLE "tag" (
154   "id" serial NOT NULL,
155   "tag" text NOT NULL,
156   "obsolete" boolean DEFAULT false,
157   PRIMARY KEY ("id"),
158   CONSTRAINT "tag_tag_key" UNIQUE ("tag")
159 );
160
161 ;
162 --
163 -- Table: correspondent_full_name.
164 --
165 CREATE TABLE "correspondent_full_name" (
166   "id" serial NOT NULL,
167   "correspondent" integer NOT NULL,
168   "full_name" text NOT NULL,
169   "last_seen" timestamp DEFAULT current_timestamp NOT NULL,
170   PRIMARY KEY ("id"),
171   CONSTRAINT "correspondent_full_name_correspondent_full_name_idx" UNIQUE ("correspondent", "full_name")
172 );
173 CREATE INDEX "correspondent_full_name_idx_correspondent" on "correspondent_full_name" ("correspondent");
174
175 ;
176 --
177 -- Table: maintainer.
178 --
179 CREATE TABLE "maintainer" (
180   "id" serial NOT NULL,
181   "name" text NOT NULL,
182   "correspondent" integer NOT NULL,
183   "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
184   "modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
185   PRIMARY KEY ("id"),
186   CONSTRAINT "maintainer_name_idx" UNIQUE ("name")
187 );
188 CREATE INDEX "maintainer_idx_correspondent" on "maintainer" ("correspondent");
189
190 ;
191 --
192 -- Table: message_refs.
193 --
194 CREATE TABLE "message_refs" (
195   "id" serial NOT NULL,
196   "message" integer NOT NULL,
197   "refs" integer NOT NULL,
198   "inferred" boolean DEFAULT false,
199   "primary_ref" boolean DEFAULT false,
200   PRIMARY KEY ("id"),
201   CONSTRAINT "message_refs_message_refs_idx" UNIQUE ("message", "refs")
202 );
203 CREATE INDEX "message_refs_idx_message" on "message_refs" ("message");
204 CREATE INDEX "message_refs_idx_refs" on "message_refs" ("refs");
205
206 ;
207 --
208 -- Table: bug.
209 --
210 CREATE TABLE "bug" (
211   "id" integer NOT NULL,
212   "creation" timestamp with time zone DEFAULT current_timestamp NOT NULL,
213   "log_modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
214   "last_modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
215   "archived" boolean DEFAULT false NOT NULL,
216   "unarchived" timestamp with time zone,
217   "forwarded" text DEFAULT '' NOT NULL,
218   "summary" text DEFAULT '' NOT NULL,
219   "outlook" text DEFAULT '' NOT NULL,
220   "subject" text NOT NULL,
221   "severity" integer NOT NULL,
222   "done" integer,
223   "done_full" text DEFAULT '' NOT NULL,
224   "owner" integer,
225   "owner_full" text DEFAULT '' NOT NULL,
226   "submitter" integer,
227   "submitter_full" text DEFAULT '' NOT NULL,
228   "unknown_packages" text DEFAULT '' NOT NULL,
229   PRIMARY KEY ("id")
230 );
231 CREATE INDEX "bug_idx_done" on "bug" ("done");
232 CREATE INDEX "bug_idx_owner" on "bug" ("owner");
233 CREATE INDEX "bug_idx_severity" on "bug" ("severity");
234 CREATE INDEX "bug_idx_submitter" on "bug" ("submitter");
235
236 ;
237 --
238 -- Table: message_correspondent.
239 --
240 CREATE TABLE "message_correspondent" (
241   "id" serial NOT NULL,
242   "message" integer NOT NULL,
243   "correspondent" integer NOT NULL,
244   "correspondent_type" character varying DEFAULT 'to' NOT NULL,
245   PRIMARY KEY ("id"),
246   CONSTRAINT "message_correspondent_message_correspondent_correspondent_t_idx" UNIQUE ("message", "correspondent", "correspondent_type")
247 );
248 CREATE INDEX "message_correspondent_idx_correspondent" on "message_correspondent" ("correspondent");
249 CREATE INDEX "message_correspondent_idx_message" on "message_correspondent" ("message");
250
251 ;
252 --
253 -- Table: bug_blocks.
254 --
255 CREATE TABLE "bug_blocks" (
256   "id" serial NOT NULL,
257   "bug" integer NOT NULL,
258   "blocks" integer NOT NULL,
259   PRIMARY KEY ("id"),
260   CONSTRAINT "bug_blocks_bug_id_blocks_idx" UNIQUE ("bug", "blocks")
261 );
262 CREATE INDEX "bug_blocks_idx_blocks" on "bug_blocks" ("blocks");
263 CREATE INDEX "bug_blocks_idx_bug" on "bug_blocks" ("bug");
264
265 ;
266 --
267 -- Table: bug_merged.
268 --
269 CREATE TABLE "bug_merged" (
270   "id" serial NOT NULL,
271   "bug" integer NOT NULL,
272   "merged" integer NOT NULL,
273   PRIMARY KEY ("id"),
274   CONSTRAINT "bug_merged_bug_id_merged_idx" UNIQUE ("bug", "merged")
275 );
276 CREATE INDEX "bug_merged_idx_bug" on "bug_merged" ("bug");
277 CREATE INDEX "bug_merged_idx_merged" on "bug_merged" ("merged");
278
279 ;
280 --
281 -- Table: src_ver.
282 --
283 CREATE TABLE "src_ver" (
284   "id" serial NOT NULL,
285   "src_pkg" integer NOT NULL,
286   "ver" debversion NOT NULL,
287   "maintainer" integer,
288   "upload_date" timestamp with time zone DEFAULT current_timestamp NOT NULL,
289   "based_on" integer,
290   PRIMARY KEY ("id"),
291   CONSTRAINT "src_ver_src_pkg_id_ver" UNIQUE ("src_pkg", "ver")
292 );
293 CREATE INDEX "src_ver_idx_based_on" on "src_ver" ("based_on");
294 CREATE INDEX "src_ver_idx_maintainer" on "src_ver" ("maintainer");
295 CREATE INDEX "src_ver_idx_src_pkg" on "src_ver" ("src_pkg");
296
297 ;
298 --
299 -- Table: bug_binpackage.
300 --
301 CREATE TABLE "bug_binpackage" (
302   "id" serial NOT NULL,
303   "bug" integer NOT NULL,
304   "bin_pkg" integer NOT NULL,
305   PRIMARY KEY ("id"),
306   CONSTRAINT "bug_binpackage_id_pkg" UNIQUE ("bug", "bin_pkg")
307 );
308 CREATE INDEX "bug_binpackage_idx_bin_pkg" on "bug_binpackage" ("bin_pkg");
309 CREATE INDEX "bug_binpackage_idx_bug" on "bug_binpackage" ("bug");
310
311 ;
312 --
313 -- Table: bug_message.
314 --
315 CREATE TABLE "bug_message" (
316   "id" serial NOT NULL,
317   "bug" integer NOT NULL,
318   "message" integer NOT NULL,
319   "message_number" integer NOT NULL,
320   "bug_log_offset" integer,
321   "offset_valid" timestamp with time zone,
322   PRIMARY KEY ("id"),
323   CONSTRAINT "bug_message_bug_message_idx" UNIQUE ("bug", "message")
324 );
325 CREATE INDEX "bug_message_idx_bug" on "bug_message" ("bug");
326 CREATE INDEX "bug_message_idx_message" on "bug_message" ("message");
327
328 ;
329 --
330 -- Table: bug_srcpackage.
331 --
332 CREATE TABLE "bug_srcpackage" (
333   "id" serial NOT NULL,
334   "bug" integer NOT NULL,
335   "src_pkg" integer NOT NULL,
336   PRIMARY KEY ("id"),
337   CONSTRAINT "bug_srcpackage_id_pkg" UNIQUE ("bug", "src_pkg")
338 );
339 CREATE INDEX "bug_srcpackage_idx_bug" on "bug_srcpackage" ("bug");
340 CREATE INDEX "bug_srcpackage_idx_src_pkg" on "bug_srcpackage" ("src_pkg");
341
342 ;
343 --
344 -- Table: bug_tag.
345 --
346 CREATE TABLE "bug_tag" (
347   "id" serial NOT NULL,
348   "bug" integer NOT NULL,
349   "tag" integer NOT NULL,
350   PRIMARY KEY ("id"),
351   CONSTRAINT "bug_tag_bug_tag" UNIQUE ("bug", "tag")
352 );
353 CREATE INDEX "bug_tag_idx_bug" on "bug_tag" ("bug");
354 CREATE INDEX "bug_tag_idx_tag" on "bug_tag" ("tag");
355
356 ;
357 --
358 -- Table: bug_status_cache.
359 --
360 CREATE TABLE "bug_status_cache" (
361   "id" serial NOT NULL,
362   "bug" integer NOT NULL,
363   "suite" integer,
364   "arch" integer,
365   "status" character varying NOT NULL,
366   "modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
367   "asof" timestamp with time zone DEFAULT current_timestamp NOT NULL,
368   PRIMARY KEY ("id"),
369   CONSTRAINT "bug_status_cache_bug_suite_arch_idx" UNIQUE ("bug", "suite", "arch")
370 );
371 CREATE INDEX "bug_status_cache_idx_arch" on "bug_status_cache" ("arch");
372 CREATE INDEX "bug_status_cache_idx_bug" on "bug_status_cache" ("bug");
373 CREATE INDEX "bug_status_cache_idx_suite" on "bug_status_cache" ("suite");
374
375 ;
376 --
377 -- Table: src_associations.
378 --
379 CREATE TABLE "src_associations" (
380   "id" serial NOT NULL,
381   "suite" integer NOT NULL,
382   "source" integer NOT NULL,
383   "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
384   "modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
385   PRIMARY KEY ("id")
386 );
387 CREATE INDEX "src_associations_idx_source" on "src_associations" ("source");
388 CREATE INDEX "src_associations_idx_suite" on "src_associations" ("suite");
389
390 ;
391 --
392 -- Table: bin_ver.
393 --
394 CREATE TABLE "bin_ver" (
395   "id" serial NOT NULL,
396   "bin_pkg" integer NOT NULL,
397   "src_ver" integer NOT NULL,
398   "arch" integer NOT NULL,
399   "ver" debversion NOT NULL,
400   PRIMARY KEY ("id")
401 );
402 CREATE INDEX "bin_ver_idx_arch" on "bin_ver" ("arch");
403 CREATE INDEX "bin_ver_idx_bin_pkg" on "bin_ver" ("bin_pkg");
404 CREATE INDEX "bin_ver_idx_src_ver" on "bin_ver" ("src_ver");
405
406 ;
407 --
408 -- Table: bug_ver.
409 --
410 CREATE TABLE "bug_ver" (
411   "id" serial NOT NULL,
412   "bug" integer NOT NULL,
413   "ver_string" text,
414   "src_pkg" integer,
415   "src_ver" integer,
416   "found" boolean DEFAULT true NOT NULL,
417   "creation" timestamp with time zone DEFAULT current_timestamp NOT NULL,
418   "last_modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
419   PRIMARY KEY ("id"),
420   CONSTRAINT "bug_ver_bug_ver_string_found_idx" UNIQUE ("bug", "ver_string", "found")
421 );
422 CREATE INDEX "bug_ver_idx_bug" on "bug_ver" ("bug");
423 CREATE INDEX "bug_ver_idx_src_pkg" on "bug_ver" ("src_pkg");
424 CREATE INDEX "bug_ver_idx_src_ver" on "bug_ver" ("src_ver");
425
426 ;
427 --
428 -- Table: bin_associations.
429 --
430 CREATE TABLE "bin_associations" (
431   "id" serial NOT NULL,
432   "suite" integer NOT NULL,
433   "bin" integer NOT NULL,
434   "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
435   "modified" timestamp with time zone DEFAULT current_timestamp NOT NULL,
436   PRIMARY KEY ("id")
437 );
438 CREATE INDEX "bin_associations_idx_bin" on "bin_associations" ("bin");
439 CREATE INDEX "bin_associations_idx_suite" on "bin_associations" ("suite");
440
441 ;
442 --
443 -- Foreign Key Definitions
444 --
445
446 ;
447 ALTER TABLE "src_pkg" ADD CONSTRAINT "src_pkg_fk_alias_of" FOREIGN KEY ("alias_of")
448   REFERENCES "src_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
449
450 ;
451 ALTER TABLE "correspondent_full_name" ADD CONSTRAINT "correspondent_full_name_fk_correspondent" FOREIGN KEY ("correspondent")
452   REFERENCES "correspondent" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
453
454 ;
455 ALTER TABLE "maintainer" ADD CONSTRAINT "maintainer_fk_correspondent" FOREIGN KEY ("correspondent")
456   REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
457
458 ;
459 ALTER TABLE "message_refs" ADD CONSTRAINT "message_refs_fk_message" FOREIGN KEY ("message")
460   REFERENCES "message" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
461
462 ;
463 ALTER TABLE "message_refs" ADD CONSTRAINT "message_refs_fk_refs" FOREIGN KEY ("refs")
464   REFERENCES "message" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
465
466 ;
467 ALTER TABLE "bug" ADD CONSTRAINT "bug_fk_done" FOREIGN KEY ("done")
468   REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
469
470 ;
471 ALTER TABLE "bug" ADD CONSTRAINT "bug_fk_owner" FOREIGN KEY ("owner")
472   REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
473
474 ;
475 ALTER TABLE "bug" ADD CONSTRAINT "bug_fk_severity" FOREIGN KEY ("severity")
476   REFERENCES "severity" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
477
478 ;
479 ALTER TABLE "bug" ADD CONSTRAINT "bug_fk_submitter" FOREIGN KEY ("submitter")
480   REFERENCES "correspondent" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
481
482 ;
483 ALTER TABLE "message_correspondent" ADD CONSTRAINT "message_correspondent_fk_correspondent" FOREIGN KEY ("correspondent")
484   REFERENCES "correspondent" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
485
486 ;
487 ALTER TABLE "message_correspondent" ADD CONSTRAINT "message_correspondent_fk_message" FOREIGN KEY ("message")
488   REFERENCES "message" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
489
490 ;
491 ALTER TABLE "bug_blocks" ADD CONSTRAINT "bug_blocks_fk_blocks" FOREIGN KEY ("blocks")
492   REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
493
494 ;
495 ALTER TABLE "bug_blocks" ADD CONSTRAINT "bug_blocks_fk_bug" FOREIGN KEY ("bug")
496   REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
497
498 ;
499 ALTER TABLE "bug_merged" ADD CONSTRAINT "bug_merged_fk_bug" FOREIGN KEY ("bug")
500   REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
501
502 ;
503 ALTER TABLE "bug_merged" ADD CONSTRAINT "bug_merged_fk_merged" FOREIGN KEY ("merged")
504   REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
505
506 ;
507 ALTER TABLE "src_ver" ADD CONSTRAINT "src_ver_fk_based_on" FOREIGN KEY ("based_on")
508   REFERENCES "src_ver" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
509
510 ;
511 ALTER TABLE "src_ver" ADD CONSTRAINT "src_ver_fk_maintainer" FOREIGN KEY ("maintainer")
512   REFERENCES "maintainer" ("id") ON DELETE SET NULL ON UPDATE CASCADE;
513
514 ;
515 ALTER TABLE "src_ver" ADD CONSTRAINT "src_ver_fk_src_pkg" FOREIGN KEY ("src_pkg")
516   REFERENCES "src_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
517
518 ;
519 ALTER TABLE "bug_binpackage" ADD CONSTRAINT "bug_binpackage_fk_bin_pkg" FOREIGN KEY ("bin_pkg")
520   REFERENCES "bin_pkg" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
521
522 ;
523 ALTER TABLE "bug_binpackage" ADD CONSTRAINT "bug_binpackage_fk_bug" FOREIGN KEY ("bug")
524   REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
525
526 ;
527 ALTER TABLE "bug_message" ADD CONSTRAINT "bug_message_fk_bug" FOREIGN KEY ("bug")
528   REFERENCES "bug" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
529
530 ;
531 ALTER TABLE "bug_message" ADD CONSTRAINT "bug_message_fk_message" FOREIGN KEY ("message")
532   REFERENCES "message" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
533
534 ;
535 ALTER TABLE "bug_srcpackage" ADD CONSTRAINT "bug_srcpackage_fk_bug" FOREIGN KEY ("bug")
536   REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
537
538 ;
539 ALTER TABLE "bug_srcpackage" ADD CONSTRAINT "bug_srcpackage_fk_src_pkg" FOREIGN KEY ("src_pkg")
540   REFERENCES "src_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
541
542 ;
543 ALTER TABLE "bug_tag" ADD CONSTRAINT "bug_tag_fk_bug" FOREIGN KEY ("bug")
544   REFERENCES "bug" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
545
546 ;
547 ALTER TABLE "bug_tag" ADD CONSTRAINT "bug_tag_fk_tag" FOREIGN KEY ("tag")
548   REFERENCES "tag" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
549
550 ;
551 ALTER TABLE "bug_status_cache" ADD CONSTRAINT "bug_status_cache_fk_arch" FOREIGN KEY ("arch")
552   REFERENCES "arch" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
553
554 ;
555 ALTER TABLE "bug_status_cache" ADD CONSTRAINT "bug_status_cache_fk_bug" FOREIGN KEY ("bug")
556   REFERENCES "bug" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
557
558 ;
559 ALTER TABLE "bug_status_cache" ADD CONSTRAINT "bug_status_cache_fk_suite" FOREIGN KEY ("suite")
560   REFERENCES "suite" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
561
562 ;
563 ALTER TABLE "src_associations" ADD CONSTRAINT "src_associations_fk_source" FOREIGN KEY ("source")
564   REFERENCES "src_ver" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
565
566 ;
567 ALTER TABLE "src_associations" ADD CONSTRAINT "src_associations_fk_suite" FOREIGN KEY ("suite")
568   REFERENCES "suite" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
569
570 ;
571 ALTER TABLE "bin_ver" ADD CONSTRAINT "bin_ver_fk_arch" FOREIGN KEY ("arch")
572   REFERENCES "arch" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
573
574 ;
575 ALTER TABLE "bin_ver" ADD CONSTRAINT "bin_ver_fk_bin_pkg" FOREIGN KEY ("bin_pkg")
576   REFERENCES "bin_pkg" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
577
578 ;
579 ALTER TABLE "bin_ver" ADD CONSTRAINT "bin_ver_fk_src_ver" FOREIGN KEY ("src_ver")
580   REFERENCES "src_ver" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
581
582 ;
583 ALTER TABLE "bug_ver" ADD CONSTRAINT "bug_ver_fk_bug" FOREIGN KEY ("bug")
584   REFERENCES "bug" ("id") ON DELETE RESTRICT ON UPDATE CASCADE;
585
586 ;
587 ALTER TABLE "bug_ver" ADD CONSTRAINT "bug_ver_fk_src_pkg" FOREIGN KEY ("src_pkg")
588   REFERENCES "src_pkg" ("id") ON DELETE SET NULL ON UPDATE CASCADE;
589
590 ;
591 ALTER TABLE "bug_ver" ADD CONSTRAINT "bug_ver_fk_src_ver" FOREIGN KEY ("src_ver")
592   REFERENCES "src_ver" ("id") ON DELETE SET NULL ON UPDATE CASCADE;
593
594 ;
595 ALTER TABLE "bin_associations" ADD CONSTRAINT "bin_associations_fk_bin" FOREIGN KEY ("bin")
596   REFERENCES "bin_ver" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
597
598 ;
599 ALTER TABLE "bin_associations" ADD CONSTRAINT "bin_associations_fk_suite" FOREIGN KEY ("suite")
600   REFERENCES "suite" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
601
602 ;