Skip to content

Commit

Permalink
[rank] adding definition and references tables for ranking job (sourc…
Browse files Browse the repository at this point in the history
  • Loading branch information
cesrjimenez committed Feb 21, 2023
1 parent a071a07 commit 4a20c86
Show file tree
Hide file tree
Showing 6 changed files with 345 additions and 0 deletions.
231 changes: 231 additions & 0 deletions internal/database/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,15 @@
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "codeintel_ranking_definitions_id_seq",
"TypeName": "bigint",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 9223372036854775807,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "codeintel_ranking_exports_id_seq",
"TypeName": "integer",
Expand All @@ -458,6 +467,15 @@
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "codeintel_ranking_references_id_seq",
"TypeName": "bigint",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 9223372036854775807,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "configuration_policies_audit_logs_seq",
"TypeName": "bigint",
Expand Down Expand Up @@ -7337,6 +7355,124 @@
}
]
},
{
"Name": "codeintel_ranking_definitions",
"Comment": "",
"Columns": [
{
"Name": "document_path",
"Index": 5,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "graph_key",
"Index": 6,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "nextval('codeintel_ranking_definitions_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repository",
"Index": 4,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "symbol_name",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"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": ""
}
],
"Indexes": [
{
"Name": "codeintel_ranking_definitions_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_ranking_definitions_pkey ON codeintel_ranking_definitions USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "codeintel_ranking_definitions_symbol_name",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_ranking_definitions_symbol_name ON codeintel_ranking_definitions USING btree (symbol_name)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "codeintel_ranking_definitions_upload_id",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_ranking_definitions_upload_id ON codeintel_ranking_definitions USING btree (upload_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": null,
"Triggers": []
},
{
"Name": "codeintel_ranking_exports",
"Comment": "",
Expand Down Expand Up @@ -7440,6 +7576,101 @@
],
"Triggers": []
},
{
"Name": "codeintel_ranking_references",
"Comment": "References for a given upload proceduced by background job consuming SCIP indexes.",
"Columns": [
{
"Name": "graph_key",
"Index": 4,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "nextval('codeintel_ranking_references_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "processed",
"Index": 5,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "symbol_names",
"Index": 3,
"TypeName": "text[]",
"IsNullable": false,
"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": ""
}
],
"Indexes": [
{
"Name": "codeintel_ranking_references_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX codeintel_ranking_references_pkey ON codeintel_ranking_references USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "codeintel_ranking_references_upload_id",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX codeintel_ranking_references_upload_id ON codeintel_ranking_references USING btree (upload_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": null,
"Triggers": []
},
{
"Name": "configuration_policies_audit_logs",
"Comment": "",
Expand Down
34 changes: 34 additions & 0 deletions internal/database/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,23 @@ Triggers:
```

# Table "public.codeintel_ranking_definitions"
```
Column | Type | Collation | Nullable | Default
---------------+---------+-----------+----------+-----------------------------------------------------------
id | bigint | | not null | nextval('codeintel_ranking_definitions_id_seq'::regclass)
upload_id | integer | | not null |
symbol_name | text | | not null |
repository | text | | not null |
document_path | text | | not null |
graph_key | text | | not null |
Indexes:
"codeintel_ranking_definitions_pkey" PRIMARY KEY, btree (id)
"codeintel_ranking_definitions_symbol_name" btree (symbol_name)
"codeintel_ranking_definitions_upload_id" btree (upload_id)
```

# Table "public.codeintel_ranking_exports"
```
Column | Type | Collation | Nullable | Default
Expand All @@ -955,6 +972,23 @@ Foreign-key constraints:
```

# Table "public.codeintel_ranking_references"
```
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+----------------------------------------------------------
id | bigint | | not null | nextval('codeintel_ranking_references_id_seq'::regclass)
upload_id | integer | | not null |
symbol_names | text[] | | not null |
graph_key | text | | not null |
processed | boolean | | not null | false
Indexes:
"codeintel_ranking_references_pkey" PRIMARY KEY, btree (id)
"codeintel_ranking_references_upload_id" btree (upload_id)
```

References for a given upload proceduced by background job consuming SCIP indexes.

# Table "public.configuration_policies_audit_logs"
```
Column | Type | Collation | Nullable | Default
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS codeintel_ranking_definitions;
DROP TABLE IF EXISTS codeintel_ranking_references;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: add_codeintel_rank_defintions_and_references
parents: [1676996650]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CREATE TABLE IF NOT EXISTS codeintel_ranking_definitions (
id bigserial PRIMARY KEY NOT NULL,
upload_id int NOT NULL,
symbol_name text NOT NULL,
repository text NOT NULL,
document_path text NOT NULL,
graph_key text NOT NULL
);

CREATE INDEX IF NOT EXISTS codeintel_ranking_definitions_upload_id ON codeintel_ranking_definitions (upload_id);
CREATE INDEX IF NOT EXISTS codeintel_ranking_definitions_symbol_name ON codeintel_ranking_definitions (symbol_name);

CREATE TABLE IF NOT EXISTS codeintel_ranking_references (
id bigserial PRIMARY KEY NOT NULL,
upload_id int NOT NULL,
symbol_names text[] NOT NULL,
graph_key text NOT NULL,
processed boolean NOT NULL DEFAULT false
);

COMMENT ON TABLE codeintel_ranking_references IS 'References for a given upload proceduced by background job consuming SCIP indexes.';

CREATE INDEX IF NOT EXISTS codeintel_ranking_references_upload_id ON codeintel_ranking_references (upload_id);
Loading

0 comments on commit 4a20c86

Please sign in to comment.