From f81ec058abad249ebae769f297468d7064ea0ee5 Mon Sep 17 00:00:00 2001 From: Wouter Tichelaar Date: Thu, 24 Oct 2024 09:52:09 +0200 Subject: [PATCH 1/4] Added support for MSSQL to the DatabaseContextProvider --- core/config/types.ts | 1 + docs/static/schemas/config.json | 62 +++++++++++++++++++- extensions/vscode/config_schema.json | 62 +++++++++++++++++++- extensions/vscode/continue_rc_schema.json | 71 ++++++++++++++++++++++- extensions/vscode/package.json | 2 +- 5 files changed, 194 insertions(+), 4 deletions(-) diff --git a/core/config/types.ts b/core/config/types.ts index 390bc5519..36b3bb4fb 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -542,6 +542,7 @@ declare global { | "folder" | "jira" | "postgres" + | "mssql" | "database" | "code" | "docs" diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 6da984ead..68cd82bd9 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1737,6 +1737,7 @@ "highlights", "outline", "postgres", + "mssql", "code", "currentFile", "url", @@ -1986,7 +1987,7 @@ "connection_type": { "type": "string", "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": ["postgres", "mysql", "sqlite"] + "enum": ["postgres", "mysql", "sqlite", "mssql"] }, "connection": { "type": "object", @@ -2179,6 +2180,65 @@ } } }, + { + "if": { + "properties": { + "name": { + "enum": ["mssql"] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "server": { + "title": "Host", + "description": "Database host", + "default": "localhost", + "type": "string" + }, + "port": { + "title": "Port", + "description": "Database port", + "default": 5432, + "type": "integer" + }, + "user": { + "title": "User", + "description": "Database user", + "default": "postgres", + "type": "string" + }, + "password": { + "title": "Password", + "description": "Database password", + "type": "string" + }, + "database": { + "title": "Database", + "description": "Database name", + "default": "postgres", + "type": "string" + }, + "schema": { + "title": "Schema", + "description": "Database schema", + "default": "public", + "type": "string" + }, + "sampleRows": { + "title": "Sample Rows", + "description": "Number of rows to sample from the database", + "default": 3, + "type": "integer" + } + } + } + }, + "required": ["host", "port", "user", "password", "database"] + } + }, { "if": { "properties": { diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 6da984ead..68cd82bd9 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1737,6 +1737,7 @@ "highlights", "outline", "postgres", + "mssql", "code", "currentFile", "url", @@ -1986,7 +1987,7 @@ "connection_type": { "type": "string", "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": ["postgres", "mysql", "sqlite"] + "enum": ["postgres", "mysql", "sqlite", "mssql"] }, "connection": { "type": "object", @@ -2179,6 +2180,65 @@ } } }, + { + "if": { + "properties": { + "name": { + "enum": ["mssql"] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "server": { + "title": "Host", + "description": "Database host", + "default": "localhost", + "type": "string" + }, + "port": { + "title": "Port", + "description": "Database port", + "default": 5432, + "type": "integer" + }, + "user": { + "title": "User", + "description": "Database user", + "default": "postgres", + "type": "string" + }, + "password": { + "title": "Password", + "description": "Database password", + "type": "string" + }, + "database": { + "title": "Database", + "description": "Database name", + "default": "postgres", + "type": "string" + }, + "schema": { + "title": "Schema", + "description": "Database schema", + "default": "public", + "type": "string" + }, + "sampleRows": { + "title": "Sample Rows", + "description": "Number of rows to sample from the database", + "default": 3, + "type": "integer" + } + } + } + }, + "required": ["host", "port", "user", "password", "database"] + } + }, { "if": { "properties": { diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 86304fa6e..e7f291135 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -1939,6 +1939,7 @@ "highlights", "outline", "postgres", + "mssql", "code", "currentFile", "url", @@ -2234,7 +2235,8 @@ "enum": [ "postgres", "mysql", - "sqlite" + "sqlite", + "mssql" ] }, "connection": { @@ -2458,6 +2460,73 @@ } } }, + { + "if": { + "properties": { + "name": { + "enum": [ + "mssql" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "server": { + "title": "Host", + "description": "Database host", + "default": "localhost", + "type": "string" + }, + "port": { + "title": "Port", + "description": "Database port", + "default": 5432, + "type": "integer" + }, + "user": { + "title": "User", + "description": "Database user", + "default": "postgres", + "type": "string" + }, + "password": { + "title": "Password", + "description": "Database password", + "type": "string" + }, + "database": { + "title": "Database", + "description": "Database name", + "default": "postgres", + "type": "string" + }, + "schema": { + "title": "Schema", + "description": "Database schema", + "default": "public", + "type": "string" + }, + "sampleRows": { + "title": "Sample Rows", + "description": "Number of rows to sample from the database", + "default": 3, + "type": "integer" + } + } + } + }, + "required": [ + "host", + "port", + "user", + "password", + "database" + ] + } + }, { "if": { "properties": { diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 2d7a5af4f..54edefdef 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -563,7 +563,7 @@ "axios": "^1.2.5", "core": "file:../../core", "cors": "^2.8.5", - "dbinfoz": "^0.11.0", + "dbinfoz": "^0.14.0", "downshift": "^7.6.0", "esbuild": "^0.17.19", "express": "^4.18.2", From 3a8457e6fcc4a5dbe9cdbea94159f1d62143c06e Mon Sep 17 00:00:00 2001 From: Wouter Tichelaar Date: Thu, 24 Oct 2024 09:38:23 +0200 Subject: [PATCH 2/4] Update documentation --- docs/docs/customize/context-providers.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/docs/customize/context-providers.md b/docs/docs/customize/context-providers.md index 41b569604..0e9b91dce 100644 --- a/docs/docs/customize/context-providers.md +++ b/docs/docs/customize/context-providers.md @@ -390,7 +390,7 @@ By default, the `schema` filter is set to `public`, and the `sampleRows` is set ### `@Database` -Reference table schemas from Sqlite, Postgres, and MySQL databases. +Reference table schemas from Sqlite, Postgres, MSSQL, and MySQL databases. ```json title="config.json" { @@ -409,6 +409,15 @@ Reference table schemas from Sqlite, Postgres, and MySQL databases. "password": "yourPassword", "port": 5432 } + }{ + "name": "exampleMssql", + "connection_type": "mssql", + "connection": { + "user": "username", + "server": "localhost", + "database": "exampleDB", + "password": "yourPassword" + } }, { "name": "exampleSqlite", From 2984499485d7f3edeea69b9f6c61ae46f98693c3 Mon Sep 17 00:00:00 2001 From: Wouter Tichelaar <9594229+DifferentialityDevelopment@users.noreply.github.com> Date: Thu, 24 Oct 2024 19:37:02 +0200 Subject: [PATCH 3/4] Update docs/static/schemas/config.json Co-authored-by: Patrick Erichsen --- docs/static/schemas/config.json | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 68cd82bd9..107cfbee5 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1737,7 +1737,6 @@ "highlights", "outline", "postgres", - "mssql", "code", "currentFile", "url", From 7da12ce145ad69fdac3e6a3d942b6aeca1526a5c Mon Sep 17 00:00:00 2001 From: Wouter Tichelaar <9594229+DifferentialityDevelopment@users.noreply.github.com> Date: Wed, 30 Oct 2024 07:51:49 +0200 Subject: [PATCH 4/4] Update context-providers.md --- docs/docs/customize/context-providers.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/customize/context-providers.md b/docs/docs/customize/context-providers.md index 0e9b91dce..e582beb1b 100644 --- a/docs/docs/customize/context-providers.md +++ b/docs/docs/customize/context-providers.md @@ -409,7 +409,8 @@ Reference table schemas from Sqlite, Postgres, MSSQL, and MySQL databases. "password": "yourPassword", "port": 5432 } - }{ + }, + { "name": "exampleMssql", "connection_type": "mssql", "connection": {