sourcegraph/internal/database/schema.codeintel.json
Keegan Carruthers-Smith cbd12608b5
database: run tenant_id migration outside of a transaction (#64410)
We hit a deadlock when deploying this migration to s2. This is because
within our transaction of the migration we likely didn't obtain table
locks in the same order as a transaction in our application code.

So this commit introduces a new migration metadata field
"noTransaction". The documentation for migrator says you should create a
migration per needed transactions. However, this would require us to
create 100s of migrations. We believe the better approach is introducing
this field and barely advertising it.

When reading the code which actually runs migrations, there is no extra
logic done outside of BEGIN; run_migration; COMMIT; so this change is
safe.

We update the migrations to avoid duplicating the function name we
introduce in case something goes wrong (now that the transaction could
leak out the function name).

Test Plan: The actual migrations are tested by go test. I added a test
assertion that we don't call Transact, but to be honest that is super
sketchy. However, we couldn't actually find any test fixtures which
actually run against the DB. So that would require a much deeper
investment for how simple the code change is.

Co-authored-by: Erik Seliger <erikseliger@me.com>
2024-08-13 07:08:19 +02:00

1718 lines
60 KiB
JSON

{
"Extensions": [
"intarray",
"pg_stat_statements",
"pg_trgm"
],
"Enums": null,
"Functions": [
{
"Name": "get_file_extension",
"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": "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"
},
{
"Name": "update_codeintel_scip_document_lookup_schema_versions_insert",
"Definition": "CREATE OR REPLACE FUNCTION public.update_codeintel_scip_document_lookup_schema_versions_insert()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$ BEGIN\n INSERT INTO codeintel_scip_document_lookup_schema_versions\n SELECT\n upload_id,\n MIN(schema_version) as min_schema_version,\n MAX(schema_version) as max_schema_version\n FROM newtab\n JOIN codeintel_scip_documents ON codeintel_scip_documents.id = newtab.document_id\n GROUP BY newtab.upload_id\n ON CONFLICT (upload_id) DO UPDATE SET\n -- Update with min(old_min, new_min) and max(old_max, new_max)\n min_schema_version = LEAST(codeintel_scip_document_lookup_schema_versions.min_schema_version, EXCLUDED.min_schema_version),\n max_schema_version = GREATEST(codeintel_scip_document_lookup_schema_versions.max_schema_version, EXCLUDED.max_schema_version);\n RETURN NULL;\nEND $function$\n"
},
{
"Name": "update_codeintel_scip_documents_dereference_logs_delete",
"Definition": "CREATE OR REPLACE FUNCTION public.update_codeintel_scip_documents_dereference_logs_delete()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$ BEGIN\n INSERT INTO codeintel_scip_documents_dereference_logs (document_id)\n SELECT document_id FROM oldtab;\n RETURN NULL;\nEND $function$\n"
},
{
"Name": "update_codeintel_scip_symbols_schema_versions_insert",
"Definition": "CREATE OR REPLACE FUNCTION public.update_codeintel_scip_symbols_schema_versions_insert()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$ BEGIN\n INSERT INTO codeintel_scip_symbols_schema_versions\n SELECT\n upload_id,\n MIN(schema_version) as min_schema_version,\n MAX(schema_version) as max_schema_version\n FROM newtab\n GROUP BY upload_id\n ON CONFLICT (upload_id) DO UPDATE SET\n -- Update with min(old_min, new_min) and max(old_max, new_max)\n min_schema_version = LEAST(codeintel_scip_symbols_schema_versions.min_schema_version, EXCLUDED.min_schema_version),\n max_schema_version = GREATEST(codeintel_scip_symbols_schema_versions.max_schema_version, EXCLUDED.max_schema_version);\n RETURN NULL;\nEND $function$\n"
}
],
"Sequences": [
{
"Name": "codeintel_scip_document_lookup_id_seq",
"TypeName": "bigint",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 9223372036854775807,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "codeintel_scip_documents_dereference_logs_id_seq",
"TypeName": "bigint",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 9223372036854775807,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "codeintel_scip_documents_id_seq",
"TypeName": "bigint",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 9223372036854775807,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "codeintel_scip_metadata_id_seq",
"TypeName": "bigint",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 9223372036854775807,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "migration_logs_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "rockskip_ancestry_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "rockskip_repos_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "rockskip_symbols_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
}
],
"Tables": [
{
"Name": "codeintel_last_reconcile",
"Comment": "Stores the last time processed LSIF data was reconciled with the other database.",
"Columns": [
{
"Name": "dump_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "last_reconcile_at",
"Index": 2,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 3,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "codeintel_last_reconcile_dump_id_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_last_reconcile_dump_id_key ON codeintel_last_reconcile USING btree (dump_id)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (dump_id)"
},
{
"Name": "codeintel_last_reconcile_last_reconcile_at_dump_id",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_last_reconcile_last_reconcile_at_dump_id ON codeintel_last_reconcile USING btree (last_reconcile_at, dump_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "codeintel_last_reconcile_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "codeintel_scip_document_lookup",
"Comment": "A mapping from file paths to document references within a particular SCIP index.",
"Columns": [
{
"Name": "document_id",
"Index": 4,
"TypeName": "bigint",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The foreign key to the shared document payload (see the table [`codeintel_scip_document_lookup`](#table-publiccodeintel_scip_document_lookup))."
},
{
"Name": "document_path",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The file path to the document relative to the root of the index."
},
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "nextval('codeintel_scip_document_lookup_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An auto-generated identifier. This column is used as a foreign key target to reduce occurrences of the full document path value."
},
{
"Name": "tenant_id",
"Index": 5,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "upload_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the upload that provided this SCIP index."
}
],
"Indexes": [
{
"Name": "codeintel_scip_document_lookup_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_document_lookup_pkey ON codeintel_scip_document_lookup USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "codeintel_scip_document_lookup_upload_id_document_path_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_document_lookup_upload_id_document_path_key ON codeintel_scip_document_lookup USING btree (upload_id, document_path)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (upload_id, document_path)"
},
{
"Name": "codeintel_scip_document_lookup_document_id",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_scip_document_lookup_document_id ON codeintel_scip_document_lookup USING hash (document_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "codeintel_scip_document_lookup_document_id_fk",
"ConstraintType": "f",
"RefTableName": "codeintel_scip_documents",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (document_id) REFERENCES codeintel_scip_documents(id)"
},
{
"Name": "codeintel_scip_document_lookup_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": [
{
"Name": "codeintel_scip_document_lookup_schema_versions_insert",
"Definition": "CREATE TRIGGER codeintel_scip_document_lookup_schema_versions_insert AFTER INSERT ON codeintel_scip_document_lookup REFERENCING NEW TABLE AS newtab FOR EACH STATEMENT EXECUTE FUNCTION update_codeintel_scip_document_lookup_schema_versions_insert()"
},
{
"Name": "codeintel_scip_documents_dereference_logs_insert",
"Definition": "CREATE TRIGGER codeintel_scip_documents_dereference_logs_insert AFTER DELETE ON codeintel_scip_document_lookup REFERENCING OLD TABLE AS oldtab FOR EACH STATEMENT EXECUTE FUNCTION update_codeintel_scip_documents_dereference_logs_delete()"
}
]
},
{
"Name": "codeintel_scip_document_lookup_schema_versions",
"Comment": "Tracks the range of `schema_versions` values associated with each SCIP index in the [`codeintel_scip_document_lookup`](#table-publiccodeintel_scip_document_lookup) table.",
"Columns": [
{
"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 `schema_version` values of the records in the table [`codeintel_scip_document_lookup`](#table-publiccodeintel_scip_document_lookup) where the `upload_id` column matches the associated SCIP index."
},
{
"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 `schema_version` values of the records in the table [`codeintel_scip_document_lookup`](#table-publiccodeintel_scip_document_lookup) where the `upload_id` column matches the associated SCIP index."
},
{
"Name": "tenant_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "upload_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the associated SCIP index."
}
],
"Indexes": [
{
"Name": "codeintel_scip_document_lookup_schema_versions_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_document_lookup_schema_versions_pkey ON codeintel_scip_document_lookup_schema_versions USING btree (upload_id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (upload_id)"
}
],
"Constraints": [
{
"Name": "codeintel_scip_document_lookup_schema_versions_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "codeintel_scip_documents",
"Comment": "A lookup of SCIP [Document](https://sourcegraph.com/search?q=context:%40sourcegraph/all+repo:%5Egithub%5C.com/sourcegraph/scip%24+file:%5Escip%5C.proto+message+Document\u0026patternType=standard) payloads by their hash.",
"Columns": [
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "nextval('codeintel_scip_documents_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An auto-generated identifier. This column is used as a foreign key target to reduce occurrences of the full payload hash value."
},
{
"Name": "payload_hash",
"Index": 2,
"TypeName": "bytea",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "A deterministic hash of the raw SCIP payload. We use this as a unique value to enforce deduplication between indexes with the same document data."
},
{
"Name": "raw_scip_payload",
"Index": 4,
"TypeName": "bytea",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The raw, canonicalized SCIP [Document](https://sourcegraph.com/search?q=context:%40sourcegraph/all+repo:%5Egithub%5C.com/sourcegraph/scip%24+file:%5Escip%5C.proto+message+Document\u0026patternType=standard) payload."
},
{
"Name": "schema_version",
"Index": 3,
"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 (future) denormalized data."
},
{
"Name": "tenant_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "codeintel_scip_documents_payload_hash_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_documents_payload_hash_key ON codeintel_scip_documents USING btree (payload_hash)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (payload_hash)"
},
{
"Name": "codeintel_scip_documents_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_documents_pkey ON codeintel_scip_documents USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": [
{
"Name": "codeintel_scip_documents_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "codeintel_scip_documents_dereference_logs",
"Comment": "A list of document rows that were recently dereferenced by the deletion of an index.",
"Columns": [
{
"Name": "document_id",
"Index": 2,
"TypeName": "bigint",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the document that was dereferenced."
},
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "nextval('codeintel_scip_documents_dereference_logs_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "last_removal_time",
"Index": 3,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The time that the log entry was inserted."
},
{
"Name": "tenant_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "codeintel_scip_documents_dereference_logs_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_documents_dereference_logs_pkey ON codeintel_scip_documents_dereference_logs USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "codeintel_scip_documents_dereference_logs_last_removal_time_des",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_scip_documents_dereference_logs_last_removal_time_des ON codeintel_scip_documents_dereference_logs USING btree (last_removal_time DESC, document_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "codeintel_scip_documents_dereference_logs_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "codeintel_scip_metadata",
"Comment": "Global metadatadata about a single processed upload.",
"Columns": [
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "nextval('codeintel_scip_metadata_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An auto-generated identifier."
},
{
"Name": "protocol_version",
"Index": 7,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The version of the SCIP protocol used to encode this index."
},
{
"Name": "tenant_id",
"Index": 8,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "text_document_encoding",
"Index": 6,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The encoding of the text documents within this index. May affect range boundaries."
},
{
"Name": "tool_arguments",
"Index": 5,
"TypeName": "text[]",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Command-line arguments that were used to invoke this indexer."
},
{
"Name": "tool_name",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Name of the indexer that produced this index."
},
{
"Name": "tool_version",
"Index": 4,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Version of the indexer that produced this index."
},
{
"Name": "upload_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the upload that provided this SCIP index."
}
],
"Indexes": [
{
"Name": "codeintel_scip_metadata_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_metadata_pkey ON codeintel_scip_metadata USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "codeintel_scip_metadata_upload_id",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_scip_metadata_upload_id ON codeintel_scip_metadata USING btree (upload_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "codeintel_scip_metadata_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "codeintel_scip_symbol_names",
"Comment": "Stores a prefix tree of symbol names within a particular upload.",
"Columns": [
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An identifier unique within the index for this symbol name segment."
},
{
"Name": "name_segment",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The portion of the symbol name that is unique to this symbol and its children."
},
{
"Name": "prefix_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the segment that forms the prefix of this symbol, if any."
},
{
"Name": "tenant_id",
"Index": 5,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "upload_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the upload that provided this SCIP index."
}
],
"Indexes": [
{
"Name": "codeintel_scip_symbol_names_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_symbol_names_pkey ON codeintel_scip_symbol_names USING btree (upload_id, id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (upload_id, id)"
},
{
"Name": "codeintel_scip_symbol_names_upload_id_roots",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_scip_symbol_names_upload_id_roots ON codeintel_scip_symbol_names USING btree (upload_id) WHERE prefix_id IS NULL",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "codeisdntel_scip_symbol_names_upload_id_children",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeisdntel_scip_symbol_names_upload_id_children ON codeintel_scip_symbol_names USING btree (upload_id, prefix_id) WHERE prefix_id IS NOT NULL",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "codeintel_scip_symbol_names_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "codeintel_scip_symbols",
"Comment": "A mapping from SCIP [Symbol names](https://sourcegraph.com/search?q=context:%40sourcegraph/all+repo:%5Egithub%5C.com/sourcegraph/scip%24+file:%5Escip%5C.proto+message+Symbol\u0026patternType=standard) to path and ranges where that symbol occurs within a particular SCIP index.",
"Columns": [
{
"Name": "definition_ranges",
"Index": 5,
"TypeName": "bytea",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An encoded set of ranges within the associated document that have a **definition** relationship to the associated symbol."
},
{
"Name": "document_lookup_id",
"Index": 3,
"TypeName": "bigint",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "A reference to the `id` column of [`codeintel_scip_document_lookup`](#table-publiccodeintel_scip_document_lookup). Joining on this table yields the document path relative to the index root."
},
{
"Name": "implementation_ranges",
"Index": 7,
"TypeName": "bytea",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An encoded set of ranges within the associated document that have a **implementation** relationship to the associated symbol."
},
{
"Name": "reference_ranges",
"Index": 6,
"TypeName": "bytea",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An encoded set of ranges within the associated document that have a **reference** relationship to the associated symbol."
},
{
"Name": "schema_version",
"Index": 4,
"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 denormalized data."
},
{
"Name": "symbol_id",
"Index": 9,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the segment that terminates the name of this symbol. See the table [`codeintel_scip_symbol_names`](#table-publiccodeintel_scip_symbol_names) on how to reconstruct the full symbol name."
},
{
"Name": "tenant_id",
"Index": 10,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "type_definition_ranges",
"Index": 8,
"TypeName": "bytea",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "An encoded set of ranges within the associated document that have a **type definition** relationship to the associated symbol."
},
{
"Name": "upload_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the upload that provided this SCIP index."
}
],
"Indexes": [
{
"Name": "codeintel_scip_symbols_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_symbols_pkey ON codeintel_scip_symbols USING btree (upload_id, symbol_id, document_lookup_id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (upload_id, symbol_id, document_lookup_id)"
},
{
"Name": "codeintel_scip_symbols_document_lookup_id",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_scip_symbols_document_lookup_id ON codeintel_scip_symbols USING btree (document_lookup_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "codeintel_scip_symbols_document_lookup_id_fk",
"ConstraintType": "f",
"RefTableName": "codeintel_scip_document_lookup",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (document_lookup_id) REFERENCES codeintel_scip_document_lookup(id) ON DELETE CASCADE"
},
{
"Name": "codeintel_scip_symbols_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": [
{
"Name": "codeintel_scip_symbols_schema_versions_insert",
"Definition": "CREATE TRIGGER codeintel_scip_symbols_schema_versions_insert AFTER INSERT ON codeintel_scip_symbols REFERENCING NEW TABLE AS newtab FOR EACH STATEMENT EXECUTE FUNCTION update_codeintel_scip_symbols_schema_versions_insert()"
}
]
},
{
"Name": "codeintel_scip_symbols_schema_versions",
"Comment": "Tracks the range of `schema_versions` for each index in the [`codeintel_scip_symbols`](#table-publiccodeintel_scip_symbols) table.",
"Columns": [
{
"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 `schema_version` values of the records in the table [`codeintel_scip_symbols`](#table-publiccodeintel_scip_symbols) where the `upload_id` column matches the associated SCIP index."
},
{
"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 `schema_version` values of the records in the table [`codeintel_scip_symbols`](#table-publiccodeintel_scip_symbols) where the `upload_id` column matches the associated SCIP index."
},
{
"Name": "tenant_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "upload_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The identifier of the associated SCIP index."
}
],
"Indexes": [
{
"Name": "codeintel_scip_symbols_schema_versions_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_scip_symbols_schema_versions_pkey ON codeintel_scip_symbols_schema_versions USING btree (upload_id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (upload_id)"
}
],
"Constraints": [
{
"Name": "codeintel_scip_symbols_schema_versions_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "migration_logs",
"Comment": "",
"Columns": [
{
"Name": "backfilled",
"Index": 10,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "error_message",
"Index": 9,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "finished_at",
"Index": 7,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('migration_logs_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "migration_logs_schema_version",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "schema",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "started_at",
"Index": 6,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "success",
"Index": 8,
"TypeName": "boolean",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "up",
"Index": 5,
"TypeName": "boolean",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "version",
"Index": 4,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "migration_logs_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX migration_logs_pkey ON migration_logs USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": null,
"Triggers": []
},
{
"Name": "rockskip_ancestry",
"Comment": "",
"Columns": [
{
"Name": "ancestor",
"Index": 5,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "commit_id",
"Index": 3,
"TypeName": "character varying(40)",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 40,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "height",
"Index": 4,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('rockskip_ancestry_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "rockskip_ancestry_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX rockskip_ancestry_pkey ON rockskip_ancestry USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "rockskip_ancestry_repo_id_commit_id_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX rockskip_ancestry_repo_id_commit_id_key ON rockskip_ancestry USING btree (repo_id, commit_id)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (repo_id, commit_id)"
},
{
"Name": "rockskip_ancestry_repo_commit_id",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX rockskip_ancestry_repo_commit_id ON rockskip_ancestry USING btree (repo_id, commit_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "rockskip_ancestry_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "rockskip_repos",
"Comment": "",
"Columns": [
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('rockskip_repos_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "last_accessed_at",
"Index": 3,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo",
"Index": 2,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "rockskip_repos_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX rockskip_repos_pkey ON rockskip_repos USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "rockskip_repos_repo_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX rockskip_repos_repo_key ON rockskip_repos USING btree (repo)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (repo)"
},
{
"Name": "rockskip_repos_last_accessed_at",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX rockskip_repos_last_accessed_at ON rockskip_repos USING btree (last_accessed_at)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "rockskip_repos_repo",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX rockskip_repos_repo ON rockskip_repos USING btree (repo)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "rockskip_repos_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "rockskip_symbols",
"Comment": "",
"Columns": [
{
"Name": "added",
"Index": 2,
"TypeName": "integer[]",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "deleted",
"Index": 3,
"TypeName": "integer[]",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('rockskip_symbols_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "name",
"Index": 6,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "path",
"Index": 5,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 7,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "rockskip_symbols_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX rockskip_symbols_pkey ON rockskip_symbols USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "rockskip_symbols_gin",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX rockskip_symbols_gin ON rockskip_symbols USING gin (singleton_integer(repo_id) gin__int_ops, added gin__int_ops, deleted gin__int_ops, name gin_trgm_ops, singleton(name), singleton(lower(name)), path gin_trgm_ops, singleton(path), path_prefixes(path), singleton(lower(path)), path_prefixes(lower(path)), singleton(get_file_extension(path)), singleton(get_file_extension(lower(path))))",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "rockskip_symbols_repo_id_path_name",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX rockskip_symbols_repo_id_path_name ON rockskip_symbols USING btree (repo_id, path, name)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "rockskip_symbols_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "tenants",
"Comment": "The table that holds all tenants known to the instance. In enterprise instances, this table will only contain the \"default\" tenant.",
"Columns": [
{
"Name": "created_at",
"Index": 3,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The ID of the tenant. To keep tenants globally addressable, and be able to move them aronud instances more easily, the ID is NOT a serial and has to be specified explicitly. The creator of the tenant is responsible for choosing a unique ID, if it cares."
},
{
"Name": "name",
"Index": 2,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The name of the tenant. This may be displayed to the user and must be unique."
},
{
"Name": "updated_at",
"Index": 4,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "tenants_name_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX tenants_name_key ON tenants USING btree (name)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (name)"
},
{
"Name": "tenants_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX tenants_pkey ON tenants USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": [
{
"Name": "tenant_name_length",
"ConstraintType": "c",
"RefTableName": "",
"IsDeferrable": false,
"ConstraintDefinition": "CHECK (char_length(name) \u003c= 32 AND char_length(name) \u003e= 3)"
},
{
"Name": "tenant_name_valid_chars",
"ConstraintType": "c",
"RefTableName": "",
"IsDeferrable": false,
"ConstraintDefinition": "CHECK (name ~ '^[a-z](?:[a-z0-9\\_-])*[a-z0-9]$'::text)"
}
],
"Triggers": []
}
],
"Views": null
}