forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsquashed.sql
More file actions
executable file
·1077 lines (750 loc) · 53 KB
/
squashed.sql
File metadata and controls
executable file
·1077 lines (750 loc) · 53 KB
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
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
CREATE EXTENSION IF NOT EXISTS intarray;
COMMENT ON EXTENSION intarray IS 'functions, operators, and index support for 1-D arrays of integers';
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQL statements executed';
CREATE EXTENSION IF NOT EXISTS pg_trgm;
COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
CREATE FUNCTION get_file_extension(path text) RETURNS text
LANGUAGE plpgsql IMMUTABLE
AS $_$ BEGIN
RETURN substring(path FROM '\.([^\.]*)$');
END; $_$;
CREATE FUNCTION lsif_data_docs_search_private_delete() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
UPDATE lsif_data_apidocs_num_search_results_private SET count = count - (select count(*) from oldtbl);
RETURN NULL;
END $$;
CREATE FUNCTION lsif_data_docs_search_private_insert() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
UPDATE lsif_data_apidocs_num_search_results_private SET count = count + (select count(*) from newtbl);
RETURN NULL;
END $$;
CREATE FUNCTION lsif_data_docs_search_public_delete() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
UPDATE lsif_data_apidocs_num_search_results_public SET count = count - (select count(*) from oldtbl);
RETURN NULL;
END $$;
CREATE FUNCTION lsif_data_docs_search_public_insert() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
UPDATE lsif_data_apidocs_num_search_results_public SET count = count + (select count(*) from newtbl);
RETURN NULL;
END $$;
CREATE FUNCTION lsif_data_documentation_pages_delete() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
UPDATE lsif_data_apidocs_num_pages SET count = count - (select count(*) from oldtbl);
UPDATE lsif_data_apidocs_num_dumps SET count = count - (select count(DISTINCT dump_id) from oldtbl);
UPDATE lsif_data_apidocs_num_dumps_indexed SET count = count - (select count(DISTINCT dump_id) from oldtbl WHERE search_indexed='true');
RETURN NULL;
END $$;
CREATE FUNCTION lsif_data_documentation_pages_insert() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
UPDATE lsif_data_apidocs_num_pages SET count = count + (select count(*) from newtbl);
UPDATE lsif_data_apidocs_num_dumps SET count = count + (select count(DISTINCT dump_id) from newtbl);
UPDATE lsif_data_apidocs_num_dumps_indexed SET count = count + (select count(DISTINCT dump_id) from newtbl WHERE search_indexed='true');
RETURN NULL;
END $$;
CREATE FUNCTION lsif_data_documentation_pages_update() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
WITH
beforeIndexed AS (SELECT count(DISTINCT dump_id) FROM oldtbl WHERE search_indexed='true'),
afterIndexed AS (SELECT count(DISTINCT dump_id) FROM newtbl WHERE search_indexed='true')
UPDATE lsif_data_apidocs_num_dumps_indexed SET count=count + ((select * from afterIndexed) - (select * from beforeIndexed));
RETURN NULL;
END $$;
CREATE FUNCTION path_prefixes(path text) RETURNS text[]
LANGUAGE plpgsql IMMUTABLE
AS $$ BEGIN
RETURN (
SELECT array_agg(array_to_string(components[:len], '/')) prefixes
FROM
(SELECT regexp_split_to_array(path, E'/') components) t,
generate_series(1, array_length(components, 1)) AS len
);
END; $$;
CREATE FUNCTION singleton(value text) RETURNS text[]
LANGUAGE plpgsql IMMUTABLE
AS $$ BEGIN
RETURN ARRAY[value];
END; $$;
CREATE FUNCTION singleton_integer(value integer) RETURNS integer[]
LANGUAGE plpgsql IMMUTABLE
AS $$ BEGIN
RETURN ARRAY[value];
END; $$;
CREATE FUNCTION update_lsif_data_definitions_schema_versions_insert() RETURNS trigger
LANGUAGE plpgsql
AS $$ BEGIN
INSERT INTO
lsif_data_definitions_schema_versions
SELECT
dump_id,
MIN(schema_version) as min_schema_version,
MAX(schema_version) as max_schema_version
FROM
newtab
GROUP BY
dump_id
ON CONFLICT (dump_id) DO UPDATE SET
-- Update with min(old_min, new_min) and max(old_max, new_max)
min_schema_version = LEAST(lsif_data_definitions_schema_versions.min_schema_version, EXCLUDED.min_schema_version),
max_schema_version = GREATEST(lsif_data_definitions_schema_versions.max_schema_version, EXCLUDED.max_schema_version);
RETURN NULL;
END $$;
CREATE FUNCTION update_lsif_data_documents_schema_versions_insert() RETURNS trigger
LANGUAGE plpgsql
AS $$ BEGIN
INSERT INTO
lsif_data_documents_schema_versions
SELECT
dump_id,
MIN(schema_version) as min_schema_version,
MAX(schema_version) as max_schema_version
FROM
newtab
GROUP BY
dump_id
ON CONFLICT (dump_id) DO UPDATE SET
-- Update with min(old_min, new_min) and max(old_max, new_max)
min_schema_version = LEAST(lsif_data_documents_schema_versions.min_schema_version, EXCLUDED.min_schema_version),
max_schema_version = GREATEST(lsif_data_documents_schema_versions.max_schema_version, EXCLUDED.max_schema_version);
RETURN NULL;
END $$;
CREATE FUNCTION update_lsif_data_implementations_schema_versions_insert() RETURNS trigger
LANGUAGE plpgsql
AS $$ BEGIN
INSERT INTO
lsif_data_implementations_schema_versions
SELECT
dump_id,
MIN(schema_version) as min_schema_version,
MAX(schema_version) as max_schema_version
FROM
newtab
GROUP BY
dump_id
ON CONFLICT (dump_id) DO UPDATE SET
-- Update with min(old_min, new_min) and max(old_max, new_max)
min_schema_version = LEAST (lsif_data_implementations_schema_versions.min_schema_version, EXCLUDED.min_schema_version),
max_schema_version = GREATEST(lsif_data_implementations_schema_versions.max_schema_version, EXCLUDED.max_schema_version);
RETURN NULL;
END $$;
CREATE FUNCTION update_lsif_data_references_schema_versions_insert() RETURNS trigger
LANGUAGE plpgsql
AS $$ BEGIN
INSERT INTO
lsif_data_references_schema_versions
SELECT
dump_id,
MIN(schema_version) as min_schema_version,
MAX(schema_version) as max_schema_version
FROM
newtab
GROUP BY
dump_id
ON CONFLICT (dump_id) DO UPDATE SET
-- Update with min(old_min, new_min) and max(old_max, new_max)
min_schema_version = LEAST(lsif_data_references_schema_versions.min_schema_version, EXCLUDED.min_schema_version),
max_schema_version = GREATEST(lsif_data_references_schema_versions.max_schema_version, EXCLUDED.max_schema_version);
RETURN NULL;
END $$;
CREATE TABLE lsif_data_apidocs_num_dumps (
count bigint
);
CREATE TABLE lsif_data_apidocs_num_dumps_indexed (
count bigint
);
CREATE TABLE lsif_data_apidocs_num_pages (
count bigint
);
CREATE TABLE lsif_data_apidocs_num_search_results_private (
count bigint
);
CREATE TABLE lsif_data_apidocs_num_search_results_public (
count bigint
);
CREATE TABLE lsif_data_definitions (
dump_id integer NOT NULL,
scheme text NOT NULL,
identifier text NOT NULL,
data bytea,
schema_version integer NOT NULL,
num_locations integer NOT NULL
);
COMMENT ON TABLE lsif_data_definitions IS 'Associates (document, range) pairs with the import monikers attached to the range.';
COMMENT ON COLUMN lsif_data_definitions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_definitions.scheme IS 'The moniker scheme.';
COMMENT ON COLUMN lsif_data_definitions.identifier IS 'The moniker identifier.';
COMMENT ON COLUMN lsif_data_definitions.data IS 'A gob-encoded payload conforming to an array of [LocationData](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L106:6) types.';
COMMENT ON COLUMN lsif_data_definitions.schema_version IS 'The schema version of this row - used to determine presence and encoding of data.';
COMMENT ON COLUMN lsif_data_definitions.num_locations IS 'The number of locations stored in the data field.';
CREATE TABLE lsif_data_definitions_schema_versions (
dump_id integer NOT NULL,
min_schema_version integer,
max_schema_version integer
);
COMMENT ON TABLE lsif_data_definitions_schema_versions IS 'Tracks the range of schema_versions for each upload in the lsif_data_definitions table.';
COMMENT ON COLUMN lsif_data_definitions_schema_versions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table.';
COMMENT ON COLUMN lsif_data_definitions_schema_versions.min_schema_version IS 'A lower-bound on the `lsif_data_definitions.schema_version` where `lsif_data_definitions.dump_id = dump_id`.';
COMMENT ON COLUMN lsif_data_definitions_schema_versions.max_schema_version IS 'An upper-bound on the `lsif_data_definitions.schema_version` where `lsif_data_definitions.dump_id = dump_id`.';
CREATE TABLE lsif_data_docs_search_current_private (
repo_id integer NOT NULL,
dump_root text NOT NULL,
lang_name_id integer NOT NULL,
dump_id integer NOT NULL,
last_cleanup_scan_at timestamp with time zone DEFAULT now() NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
id integer NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_current_private IS 'A table indicating the most current search index for a unique repository, root, and language.';
COMMENT ON COLUMN lsif_data_docs_search_current_private.repo_id IS 'The repository identifier of the associated dump.';
COMMENT ON COLUMN lsif_data_docs_search_current_private.dump_root IS 'The root of the associated dump.';
COMMENT ON COLUMN lsif_data_docs_search_current_private.lang_name_id IS 'The interned index name of the associated dump.';
COMMENT ON COLUMN lsif_data_docs_search_current_private.dump_id IS 'The associated dump identifier.';
COMMENT ON COLUMN lsif_data_docs_search_current_private.last_cleanup_scan_at IS 'The last time this record was checked as part of a data retention scan.';
COMMENT ON COLUMN lsif_data_docs_search_current_private.created_at IS 'The time this record was inserted. The records with the latest created_at value for the same repository, root, and language is the only visible one and others will be deleted asynchronously.';
CREATE SEQUENCE lsif_data_docs_search_current_private_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_current_private_id_seq OWNED BY lsif_data_docs_search_current_private.id;
CREATE TABLE lsif_data_docs_search_current_public (
repo_id integer NOT NULL,
dump_root text NOT NULL,
lang_name_id integer NOT NULL,
dump_id integer NOT NULL,
last_cleanup_scan_at timestamp with time zone DEFAULT now() NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
id integer NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_current_public IS 'A table indicating the most current search index for a unique repository, root, and language.';
COMMENT ON COLUMN lsif_data_docs_search_current_public.repo_id IS 'The repository identifier of the associated dump.';
COMMENT ON COLUMN lsif_data_docs_search_current_public.dump_root IS 'The root of the associated dump.';
COMMENT ON COLUMN lsif_data_docs_search_current_public.lang_name_id IS 'The interned index name of the associated dump.';
COMMENT ON COLUMN lsif_data_docs_search_current_public.dump_id IS 'The associated dump identifier.';
COMMENT ON COLUMN lsif_data_docs_search_current_public.last_cleanup_scan_at IS 'The last time this record was checked as part of a data retention scan.';
COMMENT ON COLUMN lsif_data_docs_search_current_public.created_at IS 'The time this record was inserted. The records with the latest created_at value for the same repository, root, and language is the only visible one and others will be deleted asynchronously.';
CREATE SEQUENCE lsif_data_docs_search_current_public_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_current_public_id_seq OWNED BY lsif_data_docs_search_current_public.id;
CREATE TABLE lsif_data_docs_search_lang_names_private (
id bigint NOT NULL,
lang_name text NOT NULL,
tsv tsvector NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_lang_names_private IS 'Each unique language name being stored in the API docs search index.';
COMMENT ON COLUMN lsif_data_docs_search_lang_names_private.id IS 'The ID of the language name.';
COMMENT ON COLUMN lsif_data_docs_search_lang_names_private.lang_name IS 'The lowercase language name (go, java, etc.) OR, if unknown, the LSIF indexer name.';
COMMENT ON COLUMN lsif_data_docs_search_lang_names_private.tsv IS 'Indexed tsvector for the lang_name field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
CREATE SEQUENCE lsif_data_docs_search_lang_names_private_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_lang_names_private_id_seq OWNED BY lsif_data_docs_search_lang_names_private.id;
CREATE TABLE lsif_data_docs_search_lang_names_public (
id bigint NOT NULL,
lang_name text NOT NULL,
tsv tsvector NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_lang_names_public IS 'Each unique language name being stored in the API docs search index.';
COMMENT ON COLUMN lsif_data_docs_search_lang_names_public.id IS 'The ID of the language name.';
COMMENT ON COLUMN lsif_data_docs_search_lang_names_public.lang_name IS 'The lowercase language name (go, java, etc.) OR, if unknown, the LSIF indexer name.';
COMMENT ON COLUMN lsif_data_docs_search_lang_names_public.tsv IS 'Indexed tsvector for the lang_name field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
CREATE SEQUENCE lsif_data_docs_search_lang_names_public_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_lang_names_public_id_seq OWNED BY lsif_data_docs_search_lang_names_public.id;
CREATE TABLE lsif_data_docs_search_private (
id bigint NOT NULL,
repo_id integer NOT NULL,
dump_id integer NOT NULL,
dump_root text NOT NULL,
path_id text NOT NULL,
detail text NOT NULL,
lang_name_id integer NOT NULL,
repo_name_id integer NOT NULL,
tags_id integer NOT NULL,
search_key text NOT NULL,
search_key_tsv tsvector NOT NULL,
search_key_reverse_tsv tsvector NOT NULL,
label text NOT NULL,
label_tsv tsvector NOT NULL,
label_reverse_tsv tsvector NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_private IS 'A tsvector search index over API documentation (private repos only)';
COMMENT ON COLUMN lsif_data_docs_search_private.id IS 'The row ID of the search result.';
COMMENT ON COLUMN lsif_data_docs_search_private.repo_id IS 'The repo ID, from the main app DB repo table. Used to search over a select set of repos by ID.';
COMMENT ON COLUMN lsif_data_docs_search_private.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_docs_search_private.dump_root IS 'Identical to lsif_dumps.root; The working directory of the indexer image relative to the repository root.';
COMMENT ON COLUMN lsif_data_docs_search_private.path_id IS 'The fully qualified documentation page path ID, e.g. including "#section". See GraphQL codeintel.schema:documentationPage for what this is.';
COMMENT ON COLUMN lsif_data_docs_search_private.detail IS 'The detail string (e.g. the full function signature and its docs). See protocol/documentation.go:Documentation';
COMMENT ON COLUMN lsif_data_docs_search_private.lang_name_id IS 'The programming language (or indexer name) that produced the result. Foreign key into lsif_data_docs_search_lang_names_private.';
COMMENT ON COLUMN lsif_data_docs_search_private.repo_name_id IS 'The repository name that produced the result. Foreign key into lsif_data_docs_search_repo_names_private.';
COMMENT ON COLUMN lsif_data_docs_search_private.tags_id IS 'The tags from the documentation node. Foreign key into lsif_data_docs_search_tags_private.';
COMMENT ON COLUMN lsif_data_docs_search_private.search_key IS 'The search key generated by the indexer, e.g. mux.Router.ServeHTTP. It is language-specific, and likely unique within a repository (but not always.) See protocol/documentation.go:Documentation.SearchKey';
COMMENT ON COLUMN lsif_data_docs_search_private.search_key_tsv IS 'Indexed tsvector for the search_key field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
COMMENT ON COLUMN lsif_data_docs_search_private.search_key_reverse_tsv IS 'Indexed tsvector for the reverse of the search_key field, for suffix lexeme/word matching. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
COMMENT ON COLUMN lsif_data_docs_search_private.label IS 'The label string of the result, e.g. a one-line function signature. See protocol/documentation.go:Documentation';
COMMENT ON COLUMN lsif_data_docs_search_private.label_tsv IS 'Indexed tsvector for the label field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
COMMENT ON COLUMN lsif_data_docs_search_private.label_reverse_tsv IS 'Indexed tsvector for the reverse of the label field, for suffix lexeme/word matching. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
CREATE SEQUENCE lsif_data_docs_search_private_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_private_id_seq OWNED BY lsif_data_docs_search_private.id;
CREATE TABLE lsif_data_docs_search_public (
id bigint NOT NULL,
repo_id integer NOT NULL,
dump_id integer NOT NULL,
dump_root text NOT NULL,
path_id text NOT NULL,
detail text NOT NULL,
lang_name_id integer NOT NULL,
repo_name_id integer NOT NULL,
tags_id integer NOT NULL,
search_key text NOT NULL,
search_key_tsv tsvector NOT NULL,
search_key_reverse_tsv tsvector NOT NULL,
label text NOT NULL,
label_tsv tsvector NOT NULL,
label_reverse_tsv tsvector NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_public IS 'A tsvector search index over API documentation (public repos only)';
COMMENT ON COLUMN lsif_data_docs_search_public.id IS 'The row ID of the search result.';
COMMENT ON COLUMN lsif_data_docs_search_public.repo_id IS 'The repo ID, from the main app DB repo table. Used to search over a select set of repos by ID.';
COMMENT ON COLUMN lsif_data_docs_search_public.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_docs_search_public.dump_root IS 'Identical to lsif_dumps.root; The working directory of the indexer image relative to the repository root.';
COMMENT ON COLUMN lsif_data_docs_search_public.path_id IS 'The fully qualified documentation page path ID, e.g. including "#section". See GraphQL codeintel.schema:documentationPage for what this is.';
COMMENT ON COLUMN lsif_data_docs_search_public.detail IS 'The detail string (e.g. the full function signature and its docs). See protocol/documentation.go:Documentation';
COMMENT ON COLUMN lsif_data_docs_search_public.lang_name_id IS 'The programming language (or indexer name) that produced the result. Foreign key into lsif_data_docs_search_lang_names_public.';
COMMENT ON COLUMN lsif_data_docs_search_public.repo_name_id IS 'The repository name that produced the result. Foreign key into lsif_data_docs_search_repo_names_public.';
COMMENT ON COLUMN lsif_data_docs_search_public.tags_id IS 'The tags from the documentation node. Foreign key into lsif_data_docs_search_tags_public.';
COMMENT ON COLUMN lsif_data_docs_search_public.search_key IS 'The search key generated by the indexer, e.g. mux.Router.ServeHTTP. It is language-specific, and likely unique within a repository (but not always.) See protocol/documentation.go:Documentation.SearchKey';
COMMENT ON COLUMN lsif_data_docs_search_public.search_key_tsv IS 'Indexed tsvector for the search_key field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
COMMENT ON COLUMN lsif_data_docs_search_public.search_key_reverse_tsv IS 'Indexed tsvector for the reverse of the search_key field, for suffix lexeme/word matching. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
COMMENT ON COLUMN lsif_data_docs_search_public.label IS 'The label string of the result, e.g. a one-line function signature. See protocol/documentation.go:Documentation';
COMMENT ON COLUMN lsif_data_docs_search_public.label_tsv IS 'Indexed tsvector for the label field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
COMMENT ON COLUMN lsif_data_docs_search_public.label_reverse_tsv IS 'Indexed tsvector for the reverse of the label field, for suffix lexeme/word matching. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
CREATE SEQUENCE lsif_data_docs_search_public_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_public_id_seq OWNED BY lsif_data_docs_search_public.id;
CREATE TABLE lsif_data_docs_search_repo_names_private (
id bigint NOT NULL,
repo_name text NOT NULL,
tsv tsvector NOT NULL,
reverse_tsv tsvector NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_repo_names_private IS 'Each unique repository name being stored in the API docs search index.';
COMMENT ON COLUMN lsif_data_docs_search_repo_names_private.id IS 'The ID of the repository name.';
COMMENT ON COLUMN lsif_data_docs_search_repo_names_private.repo_name IS 'The fully qualified name of the repository.';
COMMENT ON COLUMN lsif_data_docs_search_repo_names_private.tsv IS 'Indexed tsvector for the lang_name field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
COMMENT ON COLUMN lsif_data_docs_search_repo_names_private.reverse_tsv IS 'Indexed tsvector for the reverse of the lang_name field, for suffix lexeme/word matching. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
CREATE SEQUENCE lsif_data_docs_search_repo_names_private_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_repo_names_private_id_seq OWNED BY lsif_data_docs_search_repo_names_private.id;
CREATE TABLE lsif_data_docs_search_repo_names_public (
id bigint NOT NULL,
repo_name text NOT NULL,
tsv tsvector NOT NULL,
reverse_tsv tsvector NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_repo_names_public IS 'Each unique repository name being stored in the API docs search index.';
COMMENT ON COLUMN lsif_data_docs_search_repo_names_public.id IS 'The ID of the repository name.';
COMMENT ON COLUMN lsif_data_docs_search_repo_names_public.repo_name IS 'The fully qualified name of the repository.';
COMMENT ON COLUMN lsif_data_docs_search_repo_names_public.tsv IS 'Indexed tsvector for the lang_name field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
COMMENT ON COLUMN lsif_data_docs_search_repo_names_public.reverse_tsv IS 'Indexed tsvector for the reverse of the lang_name field, for suffix lexeme/word matching. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
CREATE SEQUENCE lsif_data_docs_search_repo_names_public_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_repo_names_public_id_seq OWNED BY lsif_data_docs_search_repo_names_public.id;
CREATE TABLE lsif_data_docs_search_tags_private (
id bigint NOT NULL,
tags text NOT NULL,
tsv tsvector NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_tags_private IS 'Each uniques sequence of space-separated tags being stored in the API docs search index.';
COMMENT ON COLUMN lsif_data_docs_search_tags_private.id IS 'The ID of the tags.';
COMMENT ON COLUMN lsif_data_docs_search_tags_private.tags IS 'The full sequence of space-separated tags. See protocol/documentation.go:Documentation';
COMMENT ON COLUMN lsif_data_docs_search_tags_private.tsv IS 'Indexed tsvector for the tags field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
CREATE SEQUENCE lsif_data_docs_search_tags_private_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_tags_private_id_seq OWNED BY lsif_data_docs_search_tags_private.id;
CREATE TABLE lsif_data_docs_search_tags_public (
id bigint NOT NULL,
tags text NOT NULL,
tsv tsvector NOT NULL
);
COMMENT ON TABLE lsif_data_docs_search_tags_public IS 'Each uniques sequence of space-separated tags being stored in the API docs search index.';
COMMENT ON COLUMN lsif_data_docs_search_tags_public.id IS 'The ID of the tags.';
COMMENT ON COLUMN lsif_data_docs_search_tags_public.tags IS 'The full sequence of space-separated tags. See protocol/documentation.go:Documentation';
COMMENT ON COLUMN lsif_data_docs_search_tags_public.tsv IS 'Indexed tsvector for the tags field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector.';
CREATE SEQUENCE lsif_data_docs_search_tags_public_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lsif_data_docs_search_tags_public_id_seq OWNED BY lsif_data_docs_search_tags_public.id;
CREATE TABLE lsif_data_documentation_mappings (
dump_id integer NOT NULL,
path_id text NOT NULL,
result_id integer NOT NULL,
file_path text
);
COMMENT ON TABLE lsif_data_documentation_mappings IS 'Maps documentation path IDs to their corresponding integral documentationResult vertex IDs, which are unique within a dump.';
COMMENT ON COLUMN lsif_data_documentation_mappings.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_documentation_mappings.path_id IS 'The documentation page path ID, see see GraphQL codeintel.schema:documentationPage for what this is.';
COMMENT ON COLUMN lsif_data_documentation_mappings.result_id IS 'The documentationResult vertex ID.';
COMMENT ON COLUMN lsif_data_documentation_mappings.file_path IS 'The document file path for the documentationResult, if any. e.g. the path to the file where the symbol described by this documentationResult is located, if it is a symbol.';
CREATE TABLE lsif_data_documentation_pages (
dump_id integer NOT NULL,
path_id text NOT NULL,
data bytea,
search_indexed boolean DEFAULT false
);
COMMENT ON TABLE lsif_data_documentation_pages IS 'Associates documentation pathIDs to their documentation page hierarchy chunk.';
COMMENT ON COLUMN lsif_data_documentation_pages.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_documentation_pages.path_id IS 'The documentation page path ID, see see GraphQL codeintel.schema:documentationPage for what this is.';
COMMENT ON COLUMN lsif_data_documentation_pages.data IS 'A gob-encoded payload conforming to a `type DocumentationPageData struct` pointer (lib/codeintel/semantic/types.go)';
CREATE TABLE lsif_data_documentation_path_info (
dump_id integer NOT NULL,
path_id text NOT NULL,
data bytea
);
COMMENT ON TABLE lsif_data_documentation_path_info IS 'Associates documentation page pathIDs to information about what is at that pathID, its immediate children, etc.';
COMMENT ON COLUMN lsif_data_documentation_path_info.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_documentation_path_info.path_id IS 'The documentation page path ID, see see GraphQL codeintel.schema:documentationPage for what this is.';
COMMENT ON COLUMN lsif_data_documentation_path_info.data IS 'A gob-encoded payload conforming to a `type DocumentationPathInoData struct` pointer (lib/codeintel/semantic/types.go)';
CREATE TABLE lsif_data_documents (
dump_id integer NOT NULL,
path text NOT NULL,
data bytea,
schema_version integer NOT NULL,
num_diagnostics integer NOT NULL,
ranges bytea,
hovers bytea,
monikers bytea,
packages bytea,
diagnostics bytea
);
COMMENT ON TABLE lsif_data_documents IS 'Stores reference, hover text, moniker, and diagnostic data about a particular text document witin a dump.';
COMMENT ON COLUMN lsif_data_documents.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_documents.path IS 'The path of the text document relative to the associated dump root.';
COMMENT ON COLUMN lsif_data_documents.data IS 'A gob-encoded payload conforming to the [DocumentData](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L13:6) type. This field is being migrated across ranges, hovers, monikers, packages, and diagnostics columns and will be removed in a future release of Sourcegraph.';
COMMENT ON COLUMN lsif_data_documents.schema_version IS 'The schema version of this row - used to determine presence and encoding of data.';
COMMENT ON COLUMN lsif_data_documents.num_diagnostics IS 'The number of diagnostics stored in the data field.';
COMMENT ON COLUMN lsif_data_documents.ranges IS 'A gob-encoded payload conforming to the [Ranges](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L14:2) field of the DocumentDatatype.';
COMMENT ON COLUMN lsif_data_documents.hovers IS 'A gob-encoded payload conforming to the [HoversResults](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L15:2) field of the DocumentDatatype.';
COMMENT ON COLUMN lsif_data_documents.monikers IS 'A gob-encoded payload conforming to the [Monikers](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L16:2) field of the DocumentDatatype.';
COMMENT ON COLUMN lsif_data_documents.packages IS 'A gob-encoded payload conforming to the [PackageInformation](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L17:2) field of the DocumentDatatype.';
COMMENT ON COLUMN lsif_data_documents.diagnostics IS 'A gob-encoded payload conforming to the [Diagnostics](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L18:2) field of the DocumentDatatype.';
CREATE TABLE lsif_data_documents_schema_versions (
dump_id integer NOT NULL,
min_schema_version integer,
max_schema_version integer
);
COMMENT ON TABLE lsif_data_documents_schema_versions IS 'Tracks the range of schema_versions for each upload in the lsif_data_documents table.';
COMMENT ON COLUMN lsif_data_documents_schema_versions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table.';
COMMENT ON COLUMN lsif_data_documents_schema_versions.min_schema_version IS 'A lower-bound on the `lsif_data_documents.schema_version` where `lsif_data_documents.dump_id = dump_id`.';
COMMENT ON COLUMN lsif_data_documents_schema_versions.max_schema_version IS 'An upper-bound on the `lsif_data_documents.schema_version` where `lsif_data_documents.dump_id = dump_id`.';
CREATE TABLE lsif_data_implementations (
dump_id integer NOT NULL,
scheme text NOT NULL,
identifier text NOT NULL,
data bytea,
schema_version integer NOT NULL,
num_locations integer NOT NULL
);
COMMENT ON TABLE lsif_data_implementations IS 'Associates (document, range) pairs with the implementation monikers attached to the range.';
COMMENT ON COLUMN lsif_data_implementations.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_implementations.scheme IS 'The moniker scheme.';
COMMENT ON COLUMN lsif_data_implementations.identifier IS 'The moniker identifier.';
COMMENT ON COLUMN lsif_data_implementations.data IS 'A gob-encoded payload conforming to an array of [LocationData](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L106:6) types.';
COMMENT ON COLUMN lsif_data_implementations.schema_version IS 'The schema version of this row - used to determine presence and encoding of data.';
COMMENT ON COLUMN lsif_data_implementations.num_locations IS 'The number of locations stored in the data field.';
CREATE TABLE lsif_data_implementations_schema_versions (
dump_id integer NOT NULL,
min_schema_version integer,
max_schema_version integer
);
COMMENT ON TABLE lsif_data_implementations_schema_versions IS 'Tracks the range of schema_versions for each upload in the lsif_data_implementations table.';
COMMENT ON COLUMN lsif_data_implementations_schema_versions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table.';
COMMENT ON COLUMN lsif_data_implementations_schema_versions.min_schema_version IS 'A lower-bound on the `lsif_data_implementations.schema_version` where `lsif_data_implementations.dump_id = dump_id`.';
COMMENT ON COLUMN lsif_data_implementations_schema_versions.max_schema_version IS 'An upper-bound on the `lsif_data_implementations.schema_version` where `lsif_data_implementations.dump_id = dump_id`.';
CREATE TABLE lsif_data_metadata (
dump_id integer NOT NULL,
num_result_chunks integer
);
COMMENT ON TABLE lsif_data_metadata IS 'Stores the number of result chunks associated with a dump.';
COMMENT ON COLUMN lsif_data_metadata.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_metadata.num_result_chunks IS 'A bound of populated indexes in the lsif_data_result_chunks table for the associated dump. This value is used to hash identifiers into the result chunk index to which they belong.';
CREATE TABLE lsif_data_references (
dump_id integer NOT NULL,
scheme text NOT NULL,
identifier text NOT NULL,
data bytea,
schema_version integer NOT NULL,
num_locations integer NOT NULL
);
COMMENT ON TABLE lsif_data_references IS 'Associates (document, range) pairs with the export monikers attached to the range.';
COMMENT ON COLUMN lsif_data_references.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_references.scheme IS 'The moniker scheme.';
COMMENT ON COLUMN lsif_data_references.identifier IS 'The moniker identifier.';
COMMENT ON COLUMN lsif_data_references.data IS 'A gob-encoded payload conforming to an array of [LocationData](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L106:6) types.';
COMMENT ON COLUMN lsif_data_references.schema_version IS 'The schema version of this row - used to determine presence and encoding of data.';
COMMENT ON COLUMN lsif_data_references.num_locations IS 'The number of locations stored in the data field.';
CREATE TABLE lsif_data_references_schema_versions (
dump_id integer NOT NULL,
min_schema_version integer,
max_schema_version integer
);
COMMENT ON TABLE lsif_data_references_schema_versions IS 'Tracks the range of schema_versions for each upload in the lsif_data_references table.';
COMMENT ON COLUMN lsif_data_references_schema_versions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table.';
COMMENT ON COLUMN lsif_data_references_schema_versions.min_schema_version IS 'A lower-bound on the `lsif_data_references.schema_version` where `lsif_data_references.dump_id = dump_id`.';
COMMENT ON COLUMN lsif_data_references_schema_versions.max_schema_version IS 'An upper-bound on the `lsif_data_references.schema_version` where `lsif_data_references.dump_id = dump_id`.';
CREATE TABLE lsif_data_result_chunks (
dump_id integer NOT NULL,
idx integer NOT NULL,
data bytea
);
COMMENT ON TABLE lsif_data_result_chunks IS 'Associates result set identifiers with the (document path, range identifier) pairs that compose the set.';
COMMENT ON COLUMN lsif_data_result_chunks.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).';
COMMENT ON COLUMN lsif_data_result_chunks.idx IS 'The unique result chunk index within the associated dump. Every result set identifier present should hash to this index (modulo lsif_data_metadata.num_result_chunks).';
COMMENT ON COLUMN lsif_data_result_chunks.data IS 'A gob-encoded payload conforming to the [ResultChunkData](https://sourcegraph.com/github.com/sourcegraph/[email protected]/-/blob/enterprise/lib/codeintel/semantic/types.go#L76:6) type.';
CREATE TABLE rockskip_ancestry (
id integer NOT NULL,
repo_id integer NOT NULL,
commit_id character varying(40) NOT NULL,
height integer NOT NULL,
ancestor integer NOT NULL
);
CREATE SEQUENCE rockskip_ancestry_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE rockskip_ancestry_id_seq OWNED BY rockskip_ancestry.id;
CREATE TABLE rockskip_repos (
id integer NOT NULL,
repo text NOT NULL,
last_accessed_at timestamp with time zone NOT NULL
);
CREATE SEQUENCE rockskip_repos_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE rockskip_repos_id_seq OWNED BY rockskip_repos.id;
CREATE TABLE rockskip_symbols (
id integer NOT NULL,
added integer[] NOT NULL,
deleted integer[] NOT NULL,
repo_id integer NOT NULL,
path text NOT NULL,
name text NOT NULL
);
CREATE SEQUENCE rockskip_symbols_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE rockskip_symbols_id_seq OWNED BY rockskip_symbols.id;
ALTER TABLE ONLY lsif_data_docs_search_current_private ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_current_private_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_current_public ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_current_public_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_lang_names_private ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_lang_names_private_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_lang_names_public ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_lang_names_public_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_private ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_private_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_public ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_public_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_repo_names_private ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_repo_names_private_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_repo_names_public ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_repo_names_public_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_tags_private ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_tags_private_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_docs_search_tags_public ALTER COLUMN id SET DEFAULT nextval('lsif_data_docs_search_tags_public_id_seq'::regclass);
ALTER TABLE ONLY rockskip_ancestry ALTER COLUMN id SET DEFAULT nextval('rockskip_ancestry_id_seq'::regclass);
ALTER TABLE ONLY rockskip_repos ALTER COLUMN id SET DEFAULT nextval('rockskip_repos_id_seq'::regclass);
ALTER TABLE ONLY rockskip_symbols ALTER COLUMN id SET DEFAULT nextval('rockskip_symbols_id_seq'::regclass);
ALTER TABLE ONLY lsif_data_definitions
ADD CONSTRAINT lsif_data_definitions_pkey PRIMARY KEY (dump_id, scheme, identifier);
ALTER TABLE ONLY lsif_data_definitions_schema_versions
ADD CONSTRAINT lsif_data_definitions_schema_versions_pkey PRIMARY KEY (dump_id);
ALTER TABLE ONLY lsif_data_docs_search_current_private
ADD CONSTRAINT lsif_data_docs_search_current_private_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_current_public
ADD CONSTRAINT lsif_data_docs_search_current_public_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_lang_names_private
ADD CONSTRAINT lsif_data_docs_search_lang_names_private_lang_name_key UNIQUE (lang_name);
ALTER TABLE ONLY lsif_data_docs_search_lang_names_private
ADD CONSTRAINT lsif_data_docs_search_lang_names_private_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_lang_names_public
ADD CONSTRAINT lsif_data_docs_search_lang_names_public_lang_name_key UNIQUE (lang_name);
ALTER TABLE ONLY lsif_data_docs_search_lang_names_public
ADD CONSTRAINT lsif_data_docs_search_lang_names_public_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_private
ADD CONSTRAINT lsif_data_docs_search_private_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_public
ADD CONSTRAINT lsif_data_docs_search_public_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_repo_names_private
ADD CONSTRAINT lsif_data_docs_search_repo_names_private_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_repo_names_private
ADD CONSTRAINT lsif_data_docs_search_repo_names_private_repo_name_key UNIQUE (repo_name);
ALTER TABLE ONLY lsif_data_docs_search_repo_names_public
ADD CONSTRAINT lsif_data_docs_search_repo_names_public_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_repo_names_public
ADD CONSTRAINT lsif_data_docs_search_repo_names_public_repo_name_key UNIQUE (repo_name);
ALTER TABLE ONLY lsif_data_docs_search_tags_private
ADD CONSTRAINT lsif_data_docs_search_tags_private_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_tags_private
ADD CONSTRAINT lsif_data_docs_search_tags_private_tags_key UNIQUE (tags);
ALTER TABLE ONLY lsif_data_docs_search_tags_public
ADD CONSTRAINT lsif_data_docs_search_tags_public_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lsif_data_docs_search_tags_public
ADD CONSTRAINT lsif_data_docs_search_tags_public_tags_key UNIQUE (tags);
ALTER TABLE ONLY lsif_data_documentation_mappings
ADD CONSTRAINT lsif_data_documentation_mappings_pkey PRIMARY KEY (dump_id, path_id);
ALTER TABLE ONLY lsif_data_documentation_pages
ADD CONSTRAINT lsif_data_documentation_pages_pkey PRIMARY KEY (dump_id, path_id);
ALTER TABLE ONLY lsif_data_documentation_path_info
ADD CONSTRAINT lsif_data_documentation_path_info_pkey PRIMARY KEY (dump_id, path_id);
ALTER TABLE ONLY lsif_data_documents
ADD CONSTRAINT lsif_data_documents_pkey PRIMARY KEY (dump_id, path);
ALTER TABLE ONLY lsif_data_documents_schema_versions
ADD CONSTRAINT lsif_data_documents_schema_versions_pkey PRIMARY KEY (dump_id);
ALTER TABLE ONLY lsif_data_implementations
ADD CONSTRAINT lsif_data_implementations_pkey PRIMARY KEY (dump_id, scheme, identifier);
ALTER TABLE ONLY lsif_data_implementations_schema_versions
ADD CONSTRAINT lsif_data_implementations_schema_versions_pkey PRIMARY KEY (dump_id);
ALTER TABLE ONLY lsif_data_metadata
ADD CONSTRAINT lsif_data_metadata_pkey PRIMARY KEY (dump_id);
ALTER TABLE ONLY lsif_data_references
ADD CONSTRAINT lsif_data_references_pkey PRIMARY KEY (dump_id, scheme, identifier);
ALTER TABLE ONLY lsif_data_references_schema_versions
ADD CONSTRAINT lsif_data_references_schema_versions_pkey PRIMARY KEY (dump_id);
ALTER TABLE ONLY lsif_data_result_chunks
ADD CONSTRAINT lsif_data_result_chunks_pkey PRIMARY KEY (dump_id, idx);
ALTER TABLE ONLY rockskip_ancestry
ADD CONSTRAINT rockskip_ancestry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY rockskip_ancestry
ADD CONSTRAINT rockskip_ancestry_repo_id_commit_id_key UNIQUE (repo_id, commit_id);
ALTER TABLE ONLY rockskip_repos
ADD CONSTRAINT rockskip_repos_pkey PRIMARY KEY (id);
ALTER TABLE ONLY rockskip_repos
ADD CONSTRAINT rockskip_repos_repo_key UNIQUE (repo);
ALTER TABLE ONLY rockskip_symbols
ADD CONSTRAINT rockskip_symbols_pkey PRIMARY KEY (id);
CREATE INDEX lsif_data_definitions_dump_id_schema_version ON lsif_data_definitions USING btree (dump_id, schema_version);
CREATE INDEX lsif_data_definitions_schema_versions_dump_id_schema_version_bo ON lsif_data_definitions_schema_versions USING btree (dump_id, min_schema_version, max_schema_version);
CREATE INDEX lsif_data_docs_search_current_private_last_cleanup_scan_at ON lsif_data_docs_search_current_private USING btree (last_cleanup_scan_at);
CREATE INDEX lsif_data_docs_search_current_private_lookup ON lsif_data_docs_search_current_private USING btree (repo_id, dump_root, lang_name_id, created_at) INCLUDE (dump_id);
CREATE INDEX lsif_data_docs_search_current_public_last_cleanup_scan_at ON lsif_data_docs_search_current_public USING btree (last_cleanup_scan_at);
CREATE INDEX lsif_data_docs_search_current_public_lookup ON lsif_data_docs_search_current_public USING btree (repo_id, dump_root, lang_name_id, created_at) INCLUDE (dump_id);
CREATE INDEX lsif_data_docs_search_lang_names_private_tsv_idx ON lsif_data_docs_search_lang_names_private USING gin (tsv);
CREATE INDEX lsif_data_docs_search_lang_names_public_tsv_idx ON lsif_data_docs_search_lang_names_public USING gin (tsv);
CREATE INDEX lsif_data_docs_search_private_dump_id_idx ON lsif_data_docs_search_private USING btree (dump_id);
CREATE INDEX lsif_data_docs_search_private_dump_root_idx ON lsif_data_docs_search_private USING btree (dump_root);
CREATE INDEX lsif_data_docs_search_private_label_reverse_tsv_idx ON lsif_data_docs_search_private USING gin (label_reverse_tsv);
CREATE INDEX lsif_data_docs_search_private_label_tsv_idx ON lsif_data_docs_search_private USING gin (label_tsv);
CREATE INDEX lsif_data_docs_search_private_repo_id_idx ON lsif_data_docs_search_private USING btree (repo_id);
CREATE INDEX lsif_data_docs_search_private_search_key_reverse_tsv_idx ON lsif_data_docs_search_private USING gin (search_key_reverse_tsv);
CREATE INDEX lsif_data_docs_search_private_search_key_tsv_idx ON lsif_data_docs_search_private USING gin (search_key_tsv);
CREATE INDEX lsif_data_docs_search_public_dump_id_idx ON lsif_data_docs_search_public USING btree (dump_id);
CREATE INDEX lsif_data_docs_search_public_dump_root_idx ON lsif_data_docs_search_public USING btree (dump_root);
CREATE INDEX lsif_data_docs_search_public_label_reverse_tsv_idx ON lsif_data_docs_search_public USING gin (label_reverse_tsv);
CREATE INDEX lsif_data_docs_search_public_label_tsv_idx ON lsif_data_docs_search_public USING gin (label_tsv);
CREATE INDEX lsif_data_docs_search_public_repo_id_idx ON lsif_data_docs_search_public USING btree (repo_id);
CREATE INDEX lsif_data_docs_search_public_search_key_reverse_tsv_idx ON lsif_data_docs_search_public USING gin (search_key_reverse_tsv);
CREATE INDEX lsif_data_docs_search_public_search_key_tsv_idx ON lsif_data_docs_search_public USING gin (search_key_tsv);
CREATE INDEX lsif_data_docs_search_repo_names_private_reverse_tsv_idx ON lsif_data_docs_search_repo_names_private USING gin (reverse_tsv);
CREATE INDEX lsif_data_docs_search_repo_names_private_tsv_idx ON lsif_data_docs_search_repo_names_private USING gin (tsv);
CREATE INDEX lsif_data_docs_search_repo_names_public_reverse_tsv_idx ON lsif_data_docs_search_repo_names_public USING gin (reverse_tsv);