-
Notifications
You must be signed in to change notification settings - Fork 1
/
planet.psql
907 lines (614 loc) · 25 KB
/
planet.psql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
--
-- PostgreSQL database dump
--
SET client_encoding = 'LATIN1';
SET check_function_bodies = false;
SET SESSION AUTHORIZATION 'postgres';
--
-- TOC entry 4 (OID 2200)
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;
GRANT ALL ON SCHEMA public TO GROUP planet;
SET SESSION AUTHORIZATION 'jacobm';
SET search_path = public, pg_catalog;
--
-- TOC entry 11 (OID 17692)
-- Name: contributors; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE contributors (
id integer DEFAULT nextval('contributors_pk'::text) NOT NULL,
username character varying(63),
realname character varying(63),
"password" character varying(36) NOT NULL,
date_created timestamp with time zone DEFAULT ('now'::text)::timestamp(6) with time zone,
email character varying NOT NULL,
passcode text
);
--
-- TOC entry 14 (OID 17692)
-- Name: contributors; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE contributors FROM PUBLIC;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 15 (OID 17699)
-- Name: package_versions; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE package_versions (
id integer DEFAULT nextval('package_versions_pk'::text) NOT NULL,
package_id integer NOT NULL,
maj integer NOT NULL,
min integer NOT NULL,
plt_path character varying NOT NULL,
src_path character varying NOT NULL,
default_file character varying,
doctxt character varying,
release_blurb text,
date_added timestamp with time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL,
version_name character varying,
required_core_version integer,
downloads integer,
hidden boolean DEFAULT false NOT NULL
);
--
-- TOC entry 24 (OID 17699)
-- Name: package_versions; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE package_versions FROM PUBLIC;
GRANT ALL ON TABLE package_versions TO postgres WITH GRANT OPTION;
GRANT ALL ON TABLE package_versions TO GROUP planet;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 25 (OID 17707)
-- Name: packages; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE packages (
id integer DEFAULT nextval('packages_pk'::text) NOT NULL,
owner_id integer NOT NULL,
name character varying(127) NOT NULL,
date_added timestamp with time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL,
blurb text,
homepage character varying,
hidden boolean DEFAULT false NOT NULL,
bugtrack_id integer NOT NULL
);
--
-- TOC entry 30 (OID 17707)
-- Name: packages; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE packages FROM PUBLIC;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 31 (OID 17715)
-- Name: dependences; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE dependences (
id integer NOT NULL,
package_version_id integer NOT NULL,
package_id integer NOT NULL,
maj integer,
min_lo integer DEFAULT 0 NOT NULL,
min_hi integer
);
--
-- TOC entry 37 (OID 17718)
-- Name: categories; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE categories (
id integer NOT NULL,
name character varying NOT NULL,
sort_order integer NOT NULL,
shortname character varying NOT NULL
);
--
-- TOC entry 40 (OID 17718)
-- Name: categories; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE categories FROM PUBLIC;
GRANT ALL ON TABLE categories TO postgres WITH GRANT OPTION;
GRANT ALL ON TABLE categories TO GROUP planet;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 41 (OID 17723)
-- Name: downloads; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE downloads (
id integer DEFAULT nextval('downloads_pk'::text) NOT NULL,
"time" timestamp with time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL,
package_version_id integer NOT NULL,
ip character varying(15) NOT NULL,
client_version character varying NOT NULL
);
--
-- TOC entry 46 (OID 17723)
-- Name: downloads; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE downloads FROM PUBLIC;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 47 (OID 17730)
-- Name: package_categories; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE package_categories (
package_id integer NOT NULL,
category_id integer NOT NULL
);
--
-- TOC entry 48 (OID 17730)
-- Name: package_categories; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE package_categories FROM PUBLIC;
GRANT ALL ON TABLE package_categories TO postgres WITH GRANT OPTION;
GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE package_categories TO GROUP planet;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 5 (OID 17732)
-- Name: package_versions_pk; Type: SEQUENCE; Schema: public; Owner: jacobm
--
CREATE SEQUENCE package_versions_pk
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 6 (OID 17734)
-- Name: packages_pk; Type: SEQUENCE; Schema: public; Owner: jacobm
--
CREATE SEQUENCE packages_pk
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 7 (OID 17736)
-- Name: contributors_pk; Type: SEQUENCE; Schema: public; Owner: jacobm
--
CREATE SEQUENCE contributors_pk
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 49 (OID 17738)
-- Name: repositories; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE repositories (
id integer NOT NULL,
name character varying NOT NULL,
client_lower_bound character varying NOT NULL,
client_upper_bound character varying NOT NULL,
sort_order integer NOT NULL
);
--
-- TOC entry 50 (OID 17738)
-- Name: repositories; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE repositories FROM PUBLIC;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 51 (OID 17743)
-- Name: version_repositories; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE version_repositories (
package_version_id integer NOT NULL,
repository_id integer NOT NULL
);
--
-- TOC entry 53 (OID 17743)
-- Name: version_repositories; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE version_repositories FROM PUBLIC;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 8 (OID 17745)
-- Name: downloads_pk; Type: SEQUENCE; Schema: public; Owner: jacobm
--
CREATE SEQUENCE downloads_pk
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 54 (OID 17747)
-- Name: errors; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE errors (
id integer DEFAULT nextval('errors_pk'::text) NOT NULL,
"time" timestamp with time zone DEFAULT now() NOT NULL,
message character varying,
ip character varying
);
--
-- TOC entry 56 (OID 17747)
-- Name: errors; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE errors FROM PUBLIC;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 9 (OID 17754)
-- Name: errors_pk; Type: SEQUENCE; Schema: public; Owner: jacobm
--
CREATE SEQUENCE errors_pk
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 57 (OID 17758)
-- Name: all_packages; Type: VIEW; Schema: public; Owner: jacobm
--
CREATE VIEW all_packages AS
SELECT c.id AS contributor_id, p.id AS package_id, pv.id AS package_version_id, c.username, p.name, pv.maj, pv.min, p.homepage, p.date_added AS create_date, pv.date_added AS version_date, pv.plt_path, pv.src_path, pv.default_file, pv.doctxt, p.blurb AS pkg_blurb, pv.release_blurb, pv.version_name, pv.required_core_version, rv.repository_id, pv.downloads, (pv.hidden OR p.hidden) AS hidden, p.bugtrack_id FROM contributors c, packages p, package_versions pv, version_repositories rv WHERE (((p.id = pv.package_id) AND (c.id = p.owner_id)) AND (rv.package_version_id = pv.id)) ORDER BY rv.repository_id, p.name, pv.maj DESC, pv.min DESC;
--
-- TOC entry 58 (OID 17762)
-- Name: all_packages_without_repositories; Type: VIEW; Schema: public; Owner: jacobm
--
CREATE VIEW all_packages_without_repositories AS
SELECT c.id AS contributor_id, p.id AS package_id, pv.id AS package_version_id, c.username, p.name, pv.maj, pv.min, p.homepage, p.date_added AS create_date, pv.date_added AS version_date, pv.plt_path, pv.src_path, pv.default_file, pv.doctxt, p.blurb AS pkg_blurb, pv.release_blurb, pv.version_name, pv.required_core_version, pv.downloads, (pv.hidden OR p.hidden) AS hidden, p.bugtrack_id FROM contributors c, packages p, package_versions pv WHERE ((p.id = pv.package_id) AND (c.id = p.owner_id)) ORDER BY p.name, pv.maj DESC, pv.min DESC;
--
-- TOC entry 59 (OID 17765)
-- Name: most_recent_packages; Type: VIEW; Schema: public; Owner: jacobm
--
CREATE VIEW most_recent_packages AS
SELECT ap.contributor_id, ap.package_id, ap.package_version_id, ap.username, ap.name, ap.maj, ap.min, ap.homepage, ap.create_date, ap.version_date, ap.plt_path, ap.src_path, ap.default_file, ap.doctxt, ap.pkg_blurb, ap.release_blurb, ap.version_name, ap.required_core_version, cat.id AS category_id, cat.name AS category_name, ap.repository_id, ap.downloads, ap.bugtrack_id FROM all_packages ap, categories cat, package_categories pc WHERE (((((ap.hidden = false) AND (ap.package_id = pc.package_id)) AND (pc.category_id = cat.id)) AND (ap.maj IN (SELECT max(pv.maj) AS max FROM package_versions pv, version_repositories vr2 WHERE ((((pv.package_id = ap.package_id) AND (vr2.package_version_id = pv.id)) AND (ap.repository_id = vr2.repository_id)) AND (pv.hidden = false))))) AND (ap.min IN (SELECT max(pv.min) AS max FROM package_versions pv, version_repositories vr2 WHERE (((((pv.package_id = ap.package_id) AND (ap.maj = pv.maj)) AND (vr2.package_version_id = pv.id)) AND (ap.repository_id = vr2.repository_id)) AND (pv.hidden = false))))) ORDER BY cat.sort_order, ap.name;
--
-- TOC entry 60 (OID 17769)
-- Name: packages_with_categories; Type: VIEW; Schema: public; Owner: jacobm
--
CREATE VIEW packages_with_categories AS
SELECT ap.contributor_id, ap.package_id, ap.package_version_id, ap.username, ap.name, ap.maj, ap.min, ap.homepage, ap.create_date, ap.version_date, ap.plt_path, ap.src_path, ap.default_file, ap.doctxt, ap.pkg_blurb, ap.release_blurb, ap.version_name, ap.required_core_version, cat.id AS category_id, cat.name AS category, ap.repository_id, ap.downloads, ap.hidden, ap.bugtrack_id FROM all_packages ap, categories cat, package_categories pc WHERE (((ap.hidden = false) AND (ap.package_id = pc.package_id)) AND (pc.category_id = cat.id)) ORDER BY ap.repository_id, cat.sort_order, ap.name, ap.maj, ap.min;
--
-- TOC entry 61 (OID 17773)
-- Name: packages_without_categories; Type: VIEW; Schema: public; Owner: jacobm
--
CREATE VIEW packages_without_categories AS
SELECT ap.contributor_id, ap.package_id, ap.package_version_id, ap.username, ap.name, ap.maj, ap.min, ap.homepage, ap.create_date, ap.version_date, ap.plt_path, ap.src_path, ap.default_file, ap.doctxt, ap.pkg_blurb, ap.release_blurb, ap.version_name, ap.required_core_version, ap.repository_id, ap.downloads, ap.bugtrack_id FROM all_packages ap WHERE (((ap.hidden = false) AND (ap.maj IN (SELECT max(pv.maj) AS max FROM package_versions pv, version_repositories vr2 WHERE ((((pv.package_id = ap.package_id) AND (pv.id = vr2.package_version_id)) AND (vr2.repository_id = ap.repository_id)) AND (pv.hidden = false))))) AND (ap.min IN (SELECT max(pv.min) AS max FROM package_versions pv, version_repositories vr2 WHERE (((((pv.package_id = ap.package_id) AND (ap.maj = pv.maj)) AND (pv.id = vr2.package_version_id)) AND (vr2.repository_id = ap.repository_id)) AND (pv.hidden = false))))) ORDER BY ap.name;
--
-- TOC entry 62 (OID 17775)
-- Name: primary_files; Type: TABLE; Schema: public; Owner: jacobm
--
CREATE TABLE primary_files (
id integer DEFAULT nextval('primary_files_pk'::text) NOT NULL,
package_version_id integer NOT NULL,
filename character varying NOT NULL,
interface text
);
--
-- TOC entry 65 (OID 17775)
-- Name: primary_files; Type: ACL; Schema: public; Owner: jacobm
--
REVOKE ALL ON TABLE primary_files FROM PUBLIC;
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 10 (OID 17781)
-- Name: primary_files_pk; Type: SEQUENCE; Schema: public; Owner: jacobm
--
CREATE SEQUENCE primary_files_pk
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 77 (OID 17783)
-- Name: downloads_time_idx; Type: INDEX; Schema: public; Owner: jacobm
--
CREATE INDEX downloads_time_idx ON downloads USING btree ("time");
--
-- TOC entry 76 (OID 17784)
-- Name: downloads_pkgversion_idx; Type: INDEX; Schema: public; Owner: jacobm
--
CREATE INDEX downloads_pkgversion_idx ON downloads USING btree (package_version_id);
--
-- TOC entry 84 (OID 17785)
-- Name: primary_files_pkgversion_idx; Type: INDEX; Schema: public; Owner: jacobm
--
CREATE INDEX primary_files_pkgversion_idx ON primary_files USING btree (package_version_id);
--
-- TOC entry 68 (OID 17786)
-- Name: package_versions_pkg_idx; Type: INDEX; Schema: public; Owner: jacobm
--
CREATE INDEX package_versions_pkg_idx ON package_versions USING btree (package_id);
--
-- TOC entry 70 (OID 17787)
-- Name: packages_owner_idx; Type: INDEX; Schema: public; Owner: jacobm
--
CREATE INDEX packages_owner_idx ON packages USING btree (owner_id);
--
-- TOC entry 66 (OID 17788)
-- Name: contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY contributors
ADD CONSTRAINT contributors_pkey PRIMARY KEY (id);
--
-- TOC entry 67 (OID 17790)
-- Name: package_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY package_versions
ADD CONSTRAINT package_versions_pkey PRIMARY KEY (id);
--
-- TOC entry 71 (OID 17792)
-- Name: packages_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY packages
ADD CONSTRAINT packages_pkey PRIMARY KEY (id);
--
-- TOC entry 72 (OID 17794)
-- Name: dependences_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY dependences
ADD CONSTRAINT dependences_pkey PRIMARY KEY (id);
--
-- TOC entry 73 (OID 17796)
-- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY categories
ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
--
-- TOC entry 75 (OID 17798)
-- Name: downloads_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY downloads
ADD CONSTRAINT downloads_pkey PRIMARY KEY (id);
--
-- TOC entry 80 (OID 17800)
-- Name: repositories_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY repositories
ADD CONSTRAINT repositories_pkey PRIMARY KEY (id);
--
-- TOC entry 79 (OID 17802)
-- Name: repositories_name_key; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY repositories
ADD CONSTRAINT repositories_name_key UNIQUE (name);
--
-- TOC entry 81 (OID 17804)
-- Name: version_repositories_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY version_repositories
ADD CONSTRAINT version_repositories_pkey PRIMARY KEY (package_version_id, repository_id);
--
-- TOC entry 82 (OID 17806)
-- Name: errors_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY errors
ADD CONSTRAINT errors_pkey PRIMARY KEY (id);
--
-- TOC entry 74 (OID 17808)
-- Name: categories_shortname_key; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY categories
ADD CONSTRAINT categories_shortname_key UNIQUE (shortname);
--
-- TOC entry 83 (OID 17810)
-- Name: primary_files_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY primary_files
ADD CONSTRAINT primary_files_pkey PRIMARY KEY (id);
--
-- TOC entry 78 (OID 17812)
-- Name: package_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY package_categories
ADD CONSTRAINT package_categories_pkey PRIMARY KEY (package_id, category_id);
--
-- TOC entry 69 (OID 17814)
-- Name: packages_bugtrack_id_key; Type: CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY packages
ADD CONSTRAINT packages_bugtrack_id_key UNIQUE (bugtrack_id);
--
-- TOC entry 86 (OID 17816)
-- Name: contributors_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY packages
ADD CONSTRAINT contributors_fkey FOREIGN KEY (owner_id) REFERENCES contributors(id);
--
-- TOC entry 87 (OID 17820)
-- Name: target_package_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY dependences
ADD CONSTRAINT target_package_fkey FOREIGN KEY (package_id) REFERENCES packages(id);
--
-- TOC entry 91 (OID 17824)
-- Name: $3; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY version_repositories
ADD CONSTRAINT "$3" FOREIGN KEY (repository_id) REFERENCES repositories(id) ON DELETE CASCADE;
--
-- TOC entry 88 (OID 17828)
-- Name: this_package_version_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY dependences
ADD CONSTRAINT this_package_version_fkey FOREIGN KEY (package_version_id) REFERENCES package_versions(id);
--
-- TOC entry 90 (OID 17832)
-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY package_categories
ADD CONSTRAINT "$2" FOREIGN KEY (category_id) REFERENCES categories(id);
--
-- TOC entry 85 (OID 17836)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY package_versions
ADD CONSTRAINT "$1" FOREIGN KEY (package_id) REFERENCES packages(id) ON DELETE CASCADE;
--
-- TOC entry 92 (OID 17840)
-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY version_repositories
ADD CONSTRAINT "$2" FOREIGN KEY (package_version_id) REFERENCES package_versions(id) ON DELETE CASCADE;
--
-- TOC entry 93 (OID 17844)
-- Name: $5; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY version_repositories
ADD CONSTRAINT "$5" FOREIGN KEY (package_version_id) REFERENCES package_versions(id) ON DELETE CASCADE;
--
-- TOC entry 89 (OID 17848)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY downloads
ADD CONSTRAINT "$1" FOREIGN KEY (package_version_id) REFERENCES package_versions(id);
--
-- TOC entry 94 (OID 17852)
-- Name: primary_files_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jacobm
--
ALTER TABLE ONLY primary_files
ADD CONSTRAINT primary_files_fkey FOREIGN KEY (package_version_id) REFERENCES package_versions(id);
SET SESSION AUTHORIZATION 'postgres';
--
-- TOC entry 3 (OID 2200)
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON SCHEMA public IS 'Standard public schema';
SET SESSION AUTHORIZATION 'jacobm';
--
-- TOC entry 12 (OID 17692)
-- Name: COLUMN contributors.email; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN contributors.email IS 'A verified email address for the contributor';
--
-- TOC entry 13 (OID 17692)
-- Name: COLUMN contributors.passcode; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN contributors.passcode IS 'Automatically generated passcode used to authenticate logins';
--
-- TOC entry 16 (OID 17699)
-- Name: COLUMN package_versions.plt_path; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN package_versions.plt_path IS 'Filesystem path to the .plt file for this package version';
--
-- TOC entry 17 (OID 17699)
-- Name: COLUMN package_versions.src_path; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN package_versions.src_path IS 'Filesystem path for the unpacked source code of this version';
--
-- TOC entry 18 (OID 17699)
-- Name: COLUMN package_versions.default_file; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN package_versions.default_file IS 'The default file for this package version';
--
-- TOC entry 19 (OID 17699)
-- Name: COLUMN package_versions.release_blurb; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN package_versions.release_blurb IS 'Blurb describing this particular release, in html format';
--
-- TOC entry 20 (OID 17699)
-- Name: COLUMN package_versions.version_name; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN package_versions.version_name IS 'Contributor-supplied textual version name with no semantics';
--
-- TOC entry 21 (OID 17699)
-- Name: COLUMN package_versions.required_core_version; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN package_versions.required_core_version IS 'Any core version requirement directly stated by this package version (not transitive)';
--
-- TOC entry 22 (OID 17699)
-- Name: COLUMN package_versions.downloads; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN package_versions.downloads IS 'number of times this package has been downloaded. Should be equal to "SELECT count(*) FROM downloads WHERE package_version_id = [this pkg id]"';
--
-- TOC entry 23 (OID 17699)
-- Name: COLUMN package_versions.hidden; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN package_versions.hidden IS 'hidden package versions are not displayed and not downloaded unless there is no other choice';
--
-- TOC entry 26 (OID 17707)
-- Name: COLUMN packages.blurb; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN packages.blurb IS 'Description of the package, in xexpr format ';
--
-- TOC entry 27 (OID 17707)
-- Name: COLUMN packages.homepage; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN packages.homepage IS 'URL representing the home page of the package';
--
-- TOC entry 28 (OID 17707)
-- Name: COLUMN packages.hidden; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN packages.hidden IS 'hidden packages are not displayed on the main page';
--
-- TOC entry 29 (OID 17707)
-- Name: COLUMN packages.bugtrack_id; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN packages.bugtrack_id IS 'ID for the id in mantis_project_table that corresponds to this package';
--
-- TOC entry 32 (OID 17715)
-- Name: COLUMN dependences.package_version_id; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN dependences.package_version_id IS 'The package version that has this dependence';
--
-- TOC entry 33 (OID 17715)
-- Name: COLUMN dependences.package_id; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN dependences.package_id IS 'The package this package version depends on';
--
-- TOC entry 34 (OID 17715)
-- Name: COLUMN dependences.maj; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN dependences.maj IS 'The major version of package_id that this package version depends on. NULL means no version was specified';
--
-- TOC entry 35 (OID 17715)
-- Name: COLUMN dependences.min_lo; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN dependences.min_lo IS 'The lowest minor package version this package can accept.';
--
-- TOC entry 36 (OID 17715)
-- Name: COLUMN dependences.min_hi; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN dependences.min_hi IS 'The highest minor version this package version can accept. NULL means no min_hi was specified.';
--
-- TOC entry 38 (OID 17718)
-- Name: COLUMN categories.sort_order; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN categories.sort_order IS 'Categories will be sorted ascending according to this number. There should not be ties, but if there are they will be resolved lexicographically.';
--
-- TOC entry 39 (OID 17718)
-- Name: COLUMN categories.shortname; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN categories.shortname IS 'Symbol name identifying this category';
--
-- TOC entry 42 (OID 17723)
-- Name: COLUMN downloads."time"; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN downloads."time" IS 'Time at which the package was downloaded.';
--
-- TOC entry 43 (OID 17723)
-- Name: COLUMN downloads.package_version_id; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN downloads.package_version_id IS 'The package version downloaded.';
--
-- TOC entry 44 (OID 17723)
-- Name: COLUMN downloads.ip; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN downloads.ip IS 'IP address of the receiver.';
--
-- TOC entry 45 (OID 17723)
-- Name: COLUMN downloads.client_version; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN downloads.client_version IS 'Client version of the receiver (e.g., "301.5" for mzscheme version 301.5)';
--
-- TOC entry 52 (OID 17743)
-- Name: TABLE version_repositories; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON TABLE version_repositories IS 'relates package versions to the repositories they can be displayed with';
--
-- TOC entry 55 (OID 17747)
-- Name: TABLE errors; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON TABLE errors IS 'Log for errors';
--
-- TOC entry 63 (OID 17775)
-- Name: TABLE primary_files; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON TABLE primary_files IS 'Associates package versions with primary files';
--
-- TOC entry 64 (OID 17775)
-- Name: COLUMN primary_files.interface; Type: COMMENT; Schema: public; Owner: jacobm
--
COMMENT ON COLUMN primary_files.interface IS 'xexpr to use to render the package''s interface (provides and provide/contracts)';