"Definition": "CREATE OR REPLACE FUNCTION public.get_file_extension(path text)\n RETURNS text\n LANGUAGE plpgsql\n IMMUTABLE\nAS $function$ BEGIN\n RETURN substring(path FROM '\\.([^\\.]*)$');\nEND; $function$\n"
},
{
"Name": "lsif_data_docs_search_private_delete",
"Definition": "CREATE OR REPLACE FUNCTION public.lsif_data_docs_search_private_delete()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\nUPDATE lsif_data_apidocs_num_search_results_private SET count = count - (select count(*) from oldtbl);\nRETURN NULL;\nEND $function$\n"
},
{
"Name": "lsif_data_docs_search_private_insert",
"Definition": "CREATE OR REPLACE FUNCTION public.lsif_data_docs_search_private_insert()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\nUPDATE lsif_data_apidocs_num_search_results_private SET count = count + (select count(*) from newtbl);\nRETURN NULL;\nEND $function$\n"
},
{
"Name": "lsif_data_docs_search_public_delete",
"Definition": "CREATE OR REPLACE FUNCTION public.lsif_data_docs_search_public_delete()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\nUPDATE lsif_data_apidocs_num_search_results_public SET count = count - (select count(*) from oldtbl);\nRETURN NULL;\nEND $function$\n"
},
{
"Name": "lsif_data_docs_search_public_insert",
"Definition": "CREATE OR REPLACE FUNCTION public.lsif_data_docs_search_public_insert()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\nUPDATE lsif_data_apidocs_num_search_results_public SET count = count + (select count(*) from newtbl);\nRETURN NULL;\nEND $function$\n"
},
{
"Name": "lsif_data_documentation_pages_delete",
"Definition": "CREATE OR REPLACE FUNCTION public.lsif_data_documentation_pages_delete()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\nUPDATE lsif_data_apidocs_num_pages SET count = count - (select count(*) from oldtbl);\nUPDATE lsif_data_apidocs_num_dumps SET count = count - (select count(DISTINCT dump_id) from oldtbl);\nUPDATE lsif_data_apidocs_num_dumps_indexed SET count = count - (select count(DISTINCT dump_id) from oldtbl WHERE search_indexed='true');\nRETURN NULL;\nEND $function$\n"
},
{
"Name": "lsif_data_documentation_pages_insert",
"Definition": "CREATE OR REPLACE FUNCTION public.lsif_data_documentation_pages_insert()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\nUPDATE lsif_data_apidocs_num_pages SET count = count + (select count(*) from newtbl);\nUPDATE lsif_data_apidocs_num_dumps SET count = count + (select count(DISTINCT dump_id) from newtbl);\nUPDATE lsif_data_apidocs_num_dumps_indexed SET count = count + (select count(DISTINCT dump_id) from newtbl WHERE search_indexed='true');\nRETURN NULL;\nEND $function$\n"
},
{
"Name": "lsif_data_documentation_pages_update",
"Definition": "CREATE OR REPLACE FUNCTION public.lsif_data_documentation_pages_update()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\nWITH\n beforeIndexed AS (SELECT count(DISTINCT dump_id) FROM oldtbl WHERE search_indexed='true'),\n afterIndexed AS (SELECT count(DISTINCT dump_id) FROM newtbl WHERE search_indexed='true')\nUPDATE lsif_data_apidocs_num_dumps_indexed SET count=count + ((select * from afterIndexed) - (select * from beforeIndexed));\nRETURN NULL;\nEND $function$\n"
},
{
"Name": "path_prefixes",
"Definition": "CREATE OR REPLACE FUNCTION public.path_prefixes(path text)\n RETURNS text[]\n LANGUAGE plpgsql\n IMMUTABLE\nAS $function$ BEGIN\n RETURN (\n SELECT array_agg(array_to_string(components[:len], '/')) prefixes\n FROM\n (SELECT regexp_split_to_array(path, E'/') components) t,\n generate_series(1, array_length(components, 1)) AS len\n );\nEND; $function$\n"
},
{
"Name": "singleton",
"Definition": "CREATE OR REPLACE FUNCTION public.singleton(value text)\n RETURNS text[]\n LANGUAGE plpgsql\n IMMUTABLE\nAS $function$ BEGIN\n RETURN ARRAY[value];\nEND; $function$\n"
},
{
"Name": "singleton_integer",
"Definition": "CREATE OR REPLACE FUNCTION public.singleton_integer(value integer)\n RETURNS integer[]\n LANGUAGE plpgsql\n IMMUTABLE\nAS $function$ BEGIN\n RETURN ARRAY[value];\nEND; $function$\n"
"Definition": "CREATE OR REPLACE FUNCTION public.update_lsif_data_implementations_schema_versions_insert()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$ BEGIN\n INSERT INTO\n lsif_data_implementations_schema_versions\n SELECT\n dump_id,\n MIN(schema_version) as min_schema_version,\n MAX(schema_version) as max_schema_version\n FROM\n newtab\n GROUP BY\n dump_id\n ON CONFLICT (dump_id) DO UPDATE SET\n -- Update with min(old_min, new_min) and max(old_max, new_max)\n min_schema_version = LEAST (lsif_data_implementations_schema_versions.min_schema_version, EXCLUDED.min_schema_version),\n max_schema_version = GREATEST(lsif_data_implementations_schema_versions.max_schema_version, EXCLUDED.max_schema_version);\n\n RETURN NULL;\nEND $function$\n"
"Comment": "Associates (document, range) pairs with the import monikers attached to the range.",
"Columns": [
{
"Name": "data",
"Index": 4,
"TypeName": "bytea",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "A gob-encoded payload conforming to an array of [LocationData](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L106:6) types."
},
{
"Name": "dump_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the associated dump in the lsif_uploads table (state=completed)."
},
{
"Name": "identifier",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The moniker identifier."
},
{
"Name": "num_locations",
"Index": 6,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The number of locations stored in the data field."
},
{
"Name": "schema_version",
"Index": 5,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The schema version of this row - used to determine presence and encoding of data."
},
{
"Name": "scheme",
"Index": 2,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The moniker scheme."
}
],
"Indexes": [
{
"Name": "lsif_data_definitions_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX lsif_data_definitions_pkey ON lsif_data_definitions USING btree (dump_id, scheme, identifier)",
"Definition": "CREATE TRIGGER lsif_data_definitions_schema_versions_insert AFTER INSERT ON lsif_data_definitions REFERENCING NEW TABLE AS newtab FOR EACH STATEMENT EXECUTE FUNCTION update_lsif_data_definitions_schema_versions_insert()"
}
]
},
{
"Name": "lsif_data_definitions_schema_versions",
"Comment": "Tracks the range of schema_versions for each upload in the lsif_data_definitions table.",
"Columns": [
{
"Name": "dump_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the associated dump in the lsif_uploads table."
},
{
"Name": "max_schema_version",
"Index": 3,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An upper-bound on the `lsif_data_definitions.schema_version` where `lsif_data_definitions.dump_id = dump_id`."
},
{
"Name": "min_schema_version",
"Index": 2,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "A lower-bound on the `lsif_data_definitions.schema_version` where `lsif_data_definitions.dump_id = dump_id`."
"IndexDefinition": "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)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": null,
"Triggers": []
},
{
"Name": "lsif_data_docs_search_current_private",
"Comment": "A table indicating the most current search index for a unique repository, root, and language.",
"Columns": [
{
"Name": "created_at",
"Index": 6,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "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."
"IndexDefinition": "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)",
"IndexDefinition": "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)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": null,
"Triggers": []
},
{
"Name": "lsif_data_docs_search_current_public",
"Comment": "A table indicating the most current search index for a unique repository, root, and language.",
"Columns": [
{
"Name": "created_at",
"Index": 6,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "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."
"IndexDefinition": "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)",
"IndexDefinition": "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)",
"Comment": "The lowercase language name (go, java, etc.) OR, if unknown, the LSIF indexer name."
},
{
"Name": "tsv",
"Index": 3,
"TypeName": "tsvector",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Indexed tsvector for the lang_name field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector."
"IndexDefinition": "CREATE UNIQUE INDEX lsif_data_docs_search_lang_names_private_lang_name_key ON lsif_data_docs_search_lang_names_private USING btree (lang_name)",
"Comment": "The lowercase language name (go, java, etc.) OR, if unknown, the LSIF indexer name."
},
{
"Name": "tsv",
"Index": 3,
"TypeName": "tsvector",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Indexed tsvector for the lang_name field. Crafted for ordered, case, and punctuation sensitivity, see data_write_documentation.go:textSearchVector."
"IndexDefinition": "CREATE UNIQUE INDEX lsif_data_docs_search_lang_names_public_lang_name_key ON lsif_data_docs_search_lang_names_public USING btree (lang_name)",
"Comment": "The label string of the result, e.g. a one-line function signature. See protocol/documentation.go:Documentation"
},
{
"Name": "label_reverse_tsv",
"Index": 15,
"TypeName": "tsvector",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "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."