Skip to content

Commit 74e4122

Browse files
committed
feat(blocks): credential-only PostgreSQL, MySQL, and SQL Server blocks
postgresql_v2, mysql_v2, and mssql_v2 spread their legacy blocks and swap the connection fields (host, port, database, username, password, and SSL mode or SQL Server encrypt and trust-certificate settings) for a saved connection picker through withSavedCredential. Their canvas sentences drop the database clause the block no longer holds. The legacy blocks change only by hideFromToolbar and a legacy sunset pointing at the successor, so existing workflows keep their inline connection fields and run exactly as before. Generated block successors, docs, icon maps, and deployment metadata are regenerated.
1 parent 7b1e534 commit 74e4122

15 files changed

Lines changed: 203 additions & 136 deletions

File tree

‎apps/docs/components/ui/icon-mapping.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,9 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
627627
mongodb: MongoDBIcon,
628628
mothership: Blimp,
629629
mssql: MicrosoftSqlIcon,
630+
mssql_v2: MicrosoftSqlIcon,
630631
mysql: MySQLIcon,
632+
mysql_v2: MySQLIcon,
631633
neo4j: Neo4jIcon,
632634
netsuite: NetSuiteIcon,
633635
neverbounce: NeverBounceIcon,
@@ -665,6 +667,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
665667
planetscale_v2: PlanetScaleIcon,
666668
polymarket: PolymarketIcon,
667669
postgresql: PostgresIcon,
670+
postgresql_v2: PostgresIcon,
668671
posthog: PosthogIcon,
669672
powerbi: PowerBIIcon,
670673
profound: ProfoundIcon,

‎apps/docs/content/docs/integrations/mssql.mdx‎

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Microsoft SQL Server
33
description: Connect to Microsoft SQL Server database
44
integration:
5-
type: "mssql"
5+
type: "mssql_v2"
66
color: "#FFFFFF"
77
---
88

@@ -29,13 +29,6 @@ Execute a SELECT query on a Microsoft SQL Server database
2929

3030
| Parameter | Type | Required | Description |
3131
| --------- | ---- | -------- | ----------- |
32-
| `host` | string | Yes | Microsoft SQL Server hostname or IP address |
33-
| `port` | number | No | Server port \(default: 1433\). A named instance must be reached through its static TCP port |
34-
| `database` | string | Yes | Database name to connect to |
35-
| `username` | string | Yes | Database username |
36-
| `password` | string | Yes | Database password |
37-
| `encrypt` | string | No | Request TLS encryption for the connection \(enabled, disabled\). Defaults to enabled. Disabling sends the login packet and every row in cleartext. Enabling requests encryption over TDS 7.4, which the server negotiates during prelogin - a server that answers NOT_SUP yields an unencrypted session rather than an error, so this is a request, not a guarantee |
38-
| `trustServerCertificate` | string | No | Trust a self-signed server certificate \(enabled, disabled\). Defaults to disabled. Enabling skips certificate validation, so the connection is open to a machine-in-the-middle |
3932
| `connectionTimeout` | number | No | Connection and request timeout in milliseconds \(default: 15000\) |
4033
| `query` | string | Yes | T-SQL SELECT query to execute, optionally led by a WITH clause. Statements that modify data or schema are rejected — use the Execute Raw SQL operation for those. |
4134

@@ -61,13 +54,6 @@ Insert data into a Microsoft SQL Server table
6154

6255
| Parameter | Type | Required | Description |
6356
| --------- | ---- | -------- | ----------- |
64-
| `host` | string | Yes | Microsoft SQL Server hostname or IP address |
65-
| `port` | number | No | Server port \(default: 1433\). A named instance must be reached through its static TCP port |
66-
| `database` | string | Yes | Database name to connect to |
67-
| `username` | string | Yes | Database username |
68-
| `password` | string | Yes | Database password |
69-
| `encrypt` | string | No | Request TLS encryption for the connection \(enabled, disabled\). Defaults to enabled. Disabling sends the login packet and every row in cleartext. Enabling requests encryption over TDS 7.4, which the server negotiates during prelogin - a server that answers NOT_SUP yields an unencrypted session rather than an error, so this is a request, not a guarantee |
70-
| `trustServerCertificate` | string | No | Trust a self-signed server certificate \(enabled, disabled\). Defaults to disabled. Enabling skips certificate validation, so the connection is open to a machine-in-the-middle |
7157
| `connectionTimeout` | number | No | Connection and request timeout in milliseconds \(default: 15000\) |
7258
| `table` | string | Yes | Table name to insert data into |
7359
| `data` | object | Yes | Data object to insert \(key-value pairs\) |
@@ -94,13 +80,6 @@ Update rows in a Microsoft SQL Server table
9480

9581
| Parameter | Type | Required | Description |
9682
| --------- | ---- | -------- | ----------- |
97-
| `host` | string | Yes | Microsoft SQL Server hostname or IP address |
98-
| `port` | number | No | Server port \(default: 1433\). A named instance must be reached through its static TCP port |
99-
| `database` | string | Yes | Database name to connect to |
100-
| `username` | string | Yes | Database username |
101-
| `password` | string | Yes | Database password |
102-
| `encrypt` | string | No | Request TLS encryption for the connection \(enabled, disabled\). Defaults to enabled. Disabling sends the login packet and every row in cleartext. Enabling requests encryption over TDS 7.4, which the server negotiates during prelogin - a server that answers NOT_SUP yields an unencrypted session rather than an error, so this is a request, not a guarantee |
103-
| `trustServerCertificate` | string | No | Trust a self-signed server certificate \(enabled, disabled\). Defaults to disabled. Enabling skips certificate validation, so the connection is open to a machine-in-the-middle |
10483
| `connectionTimeout` | number | No | Connection and request timeout in milliseconds \(default: 15000\) |
10584
| `table` | string | Yes | Table name to update |
10685
| `data` | object | Yes | Data object with the columns to set \(key-value pairs\) |
@@ -128,13 +107,6 @@ Delete rows from a Microsoft SQL Server table
128107

129108
| Parameter | Type | Required | Description |
130109
| --------- | ---- | -------- | ----------- |
131-
| `host` | string | Yes | Microsoft SQL Server hostname or IP address |
132-
| `port` | number | No | Server port \(default: 1433\). A named instance must be reached through its static TCP port |
133-
| `database` | string | Yes | Database name to connect to |
134-
| `username` | string | Yes | Database username |
135-
| `password` | string | Yes | Database password |
136-
| `encrypt` | string | No | Request TLS encryption for the connection \(enabled, disabled\). Defaults to enabled. Disabling sends the login packet and every row in cleartext. Enabling requests encryption over TDS 7.4, which the server negotiates during prelogin - a server that answers NOT_SUP yields an unencrypted session rather than an error, so this is a request, not a guarantee |
137-
| `trustServerCertificate` | string | No | Trust a self-signed server certificate \(enabled, disabled\). Defaults to disabled. Enabling skips certificate validation, so the connection is open to a machine-in-the-middle |
138110
| `connectionTimeout` | number | No | Connection and request timeout in milliseconds \(default: 15000\) |
139111
| `table` | string | Yes | Table name to delete rows from |
140112
| `where` | string | Yes | WHERE condition identifying the rows to delete |
@@ -161,13 +133,6 @@ Execute a raw T-SQL statement on a Microsoft SQL Server database
161133

162134
| Parameter | Type | Required | Description |
163135
| --------- | ---- | -------- | ----------- |
164-
| `host` | string | Yes | Microsoft SQL Server hostname or IP address |
165-
| `port` | number | No | Server port \(default: 1433\). A named instance must be reached through its static TCP port |
166-
| `database` | string | Yes | Database name to connect to |
167-
| `username` | string | Yes | Database username |
168-
| `password` | string | Yes | Database password |
169-
| `encrypt` | string | No | Request TLS encryption for the connection \(enabled, disabled\). Defaults to enabled. Disabling sends the login packet and every row in cleartext. Enabling requests encryption over TDS 7.4, which the server negotiates during prelogin - a server that answers NOT_SUP yields an unencrypted session rather than an error, so this is a request, not a guarantee |
170-
| `trustServerCertificate` | string | No | Trust a self-signed server certificate \(enabled, disabled\). Defaults to disabled. Enabling skips certificate validation, so the connection is open to a machine-in-the-middle |
171136
| `connectionTimeout` | number | No | Connection and request timeout in milliseconds \(default: 15000\) |
172137
| `query` | string | Yes | T-SQL statement to execute |
173138

@@ -193,13 +158,6 @@ Introspect a Microsoft SQL Server schema to retrieve table structures, columns,
193158

194159
| Parameter | Type | Required | Description |
195160
| --------- | ---- | -------- | ----------- |
196-
| `host` | string | Yes | Microsoft SQL Server hostname or IP address |
197-
| `port` | number | No | Server port \(default: 1433\). A named instance must be reached through its static TCP port |
198-
| `database` | string | Yes | Database name to connect to |
199-
| `username` | string | Yes | Database username |
200-
| `password` | string | Yes | Database password |
201-
| `encrypt` | string | No | Request TLS encryption for the connection \(enabled, disabled\). Defaults to enabled. Disabling sends the login packet and every row in cleartext. Enabling requests encryption over TDS 7.4, which the server negotiates during prelogin - a server that answers NOT_SUP yields an unencrypted session rather than an error, so this is a request, not a guarantee |
202-
| `trustServerCertificate` | string | No | Trust a self-signed server certificate \(enabled, disabled\). Defaults to disabled. Enabling skips certificate validation, so the connection is open to a machine-in-the-middle |
203161
| `connectionTimeout` | number | No | Connection and request timeout in milliseconds \(default: 15000\) |
204162
| `schema` | string | No | Schema to introspect \(default: dbo\) |
205163

‎apps/docs/content/docs/integrations/mysql.mdx‎

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: MySQL
33
description: Connect to MySQL database
44
integration:
5-
type: "mysql"
5+
type: "mysql_v2"
66
color: "#FFFFFF"
77
---
88

@@ -31,12 +31,6 @@ Execute SELECT query on MySQL database
3131

3232
| Parameter | Type | Required | Description |
3333
| --------- | ---- | -------- | ----------- |
34-
| `host` | string | Yes | MySQL server hostname or IP address |
35-
| `port` | number | Yes | MySQL server port \(default: 3306\) |
36-
| `database` | string | Yes | Database name to connect to \(e.g., my_database\) |
37-
| `username` | string | Yes | Database username |
38-
| `password` | string | Yes | Database password |
39-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
4034
| `query` | string | Yes | SQL SELECT query to execute \(e.g., SELECT * FROM users WHERE active = 1\) |
4135

4236
#### Output
@@ -59,12 +53,6 @@ Insert new record into MySQL database
5953

6054
| Parameter | Type | Required | Description |
6155
| --------- | ---- | -------- | ----------- |
62-
| `host` | string | Yes | MySQL server hostname or IP address |
63-
| `port` | number | Yes | MySQL server port \(default: 3306\) |
64-
| `database` | string | Yes | Database name to connect to \(e.g., my_database\) |
65-
| `username` | string | Yes | Database username |
66-
| `password` | string | Yes | Database password |
67-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
6856
| `table` | string | Yes | Table name to insert into \(e.g., users, orders\) |
6957
| `data` | object | Yes | Data to insert as key-value pairs |
7058

@@ -88,12 +76,6 @@ Update existing records in MySQL database
8876

8977
| Parameter | Type | Required | Description |
9078
| --------- | ---- | -------- | ----------- |
91-
| `host` | string | Yes | MySQL server hostname or IP address |
92-
| `port` | number | Yes | MySQL server port \(default: 3306\) |
93-
| `database` | string | Yes | Database name to connect to \(e.g., my_database\) |
94-
| `username` | string | Yes | Database username |
95-
| `password` | string | Yes | Database password |
96-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
9779
| `table` | string | Yes | Table name to update \(e.g., users, orders\) |
9880
| `data` | object | Yes | Data to update as key-value pairs |
9981
| `where` | string | Yes | WHERE clause condition \(without WHERE keyword\) |
@@ -118,12 +100,6 @@ Delete records from MySQL database
118100

119101
| Parameter | Type | Required | Description |
120102
| --------- | ---- | -------- | ----------- |
121-
| `host` | string | Yes | MySQL server hostname or IP address |
122-
| `port` | number | Yes | MySQL server port \(default: 3306\) |
123-
| `database` | string | Yes | Database name to connect to \(e.g., my_database\) |
124-
| `username` | string | Yes | Database username |
125-
| `password` | string | Yes | Database password |
126-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
127103
| `table` | string | Yes | Table name to delete from \(e.g., users, orders\) |
128104
| `where` | string | Yes | WHERE clause condition \(without WHERE keyword\) |
129105

@@ -147,12 +123,6 @@ Execute raw SQL query on MySQL database
147123

148124
| Parameter | Type | Required | Description |
149125
| --------- | ---- | -------- | ----------- |
150-
| `host` | string | Yes | MySQL server hostname or IP address |
151-
| `port` | number | Yes | MySQL server port \(default: 3306\) |
152-
| `database` | string | Yes | Database name to connect to \(e.g., my_database\) |
153-
| `username` | string | Yes | Database username |
154-
| `password` | string | Yes | Database password |
155-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
156126
| `query` | string | Yes | Raw SQL query to execute \(e.g., CREATE TABLE users \(id INT PRIMARY KEY, name VARCHAR\(255\)\)\) |
157127

158128
#### Output
@@ -175,12 +145,6 @@ Introspect MySQL database schema to retrieve table structures, columns, and rela
175145

176146
| Parameter | Type | Required | Description |
177147
| --------- | ---- | -------- | ----------- |
178-
| `host` | string | Yes | MySQL server hostname or IP address |
179-
| `port` | number | Yes | MySQL server port \(default: 3306\) |
180-
| `database` | string | Yes | Database name to connect to \(e.g., my_database\) |
181-
| `username` | string | Yes | Database username |
182-
| `password` | string | Yes | Database password |
183-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
184148

185149
#### Output
186150

‎apps/docs/content/docs/integrations/postgresql.mdx‎

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: PostgreSQL
33
description: Connect to PostgreSQL database
44
integration:
5-
type: "postgresql"
5+
type: "postgresql_v2"
66
color: "#336791"
77
---
88

@@ -29,12 +29,6 @@ Execute a SELECT query on PostgreSQL database
2929

3030
| Parameter | Type | Required | Description |
3131
| --------- | ---- | -------- | ----------- |
32-
| `host` | string | Yes | PostgreSQL server hostname or IP address |
33-
| `port` | number | Yes | PostgreSQL server port \(default: 5432\) |
34-
| `database` | string | Yes | Database name to connect to |
35-
| `username` | string | Yes | Database username |
36-
| `password` | string | Yes | Database password |
37-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
3832
| `query` | string | Yes | SQL SELECT query to execute |
3933

4034
#### Output
@@ -57,12 +51,6 @@ Insert data into PostgreSQL database
5751

5852
| Parameter | Type | Required | Description |
5953
| --------- | ---- | -------- | ----------- |
60-
| `host` | string | Yes | PostgreSQL server hostname or IP address |
61-
| `port` | number | Yes | PostgreSQL server port \(default: 5432\) |
62-
| `database` | string | Yes | Database name to connect to |
63-
| `username` | string | Yes | Database username |
64-
| `password` | string | Yes | Database password |
65-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
6654
| `table` | string | Yes | Table name to insert data into |
6755
| `data` | object | Yes | Data object to insert \(key-value pairs\) |
6856

@@ -86,12 +74,6 @@ Update data in PostgreSQL database
8674

8775
| Parameter | Type | Required | Description |
8876
| --------- | ---- | -------- | ----------- |
89-
| `host` | string | Yes | PostgreSQL server hostname or IP address |
90-
| `port` | number | Yes | PostgreSQL server port \(default: 5432\) |
91-
| `database` | string | Yes | Database name to connect to |
92-
| `username` | string | Yes | Database username |
93-
| `password` | string | Yes | Database password |
94-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
9577
| `table` | string | Yes | Table name to update data in |
9678
| `data` | object | Yes | Data object with fields to update \(key-value pairs\) |
9779
| `where` | string | Yes | WHERE clause condition \(without WHERE keyword\) |
@@ -116,12 +98,6 @@ Delete data from PostgreSQL database
11698

11799
| Parameter | Type | Required | Description |
118100
| --------- | ---- | -------- | ----------- |
119-
| `host` | string | Yes | PostgreSQL server hostname or IP address |
120-
| `port` | number | Yes | PostgreSQL server port \(default: 5432\) |
121-
| `database` | string | Yes | Database name to connect to |
122-
| `username` | string | Yes | Database username |
123-
| `password` | string | Yes | Database password |
124-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
125101
| `table` | string | Yes | Table name to delete data from |
126102
| `where` | string | Yes | WHERE clause condition \(without WHERE keyword\) |
127103

@@ -145,12 +121,6 @@ Execute raw SQL query on PostgreSQL database
145121

146122
| Parameter | Type | Required | Description |
147123
| --------- | ---- | -------- | ----------- |
148-
| `host` | string | Yes | PostgreSQL server hostname or IP address |
149-
| `port` | number | Yes | PostgreSQL server port \(default: 5432\) |
150-
| `database` | string | Yes | Database name to connect to |
151-
| `username` | string | Yes | Database username |
152-
| `password` | string | Yes | Database password |
153-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
154124
| `query` | string | Yes | Raw SQL query to execute |
155125

156126
#### Output
@@ -173,12 +143,6 @@ Introspect PostgreSQL database schema to retrieve table structures, columns, and
173143

174144
| Parameter | Type | Required | Description |
175145
| --------- | ---- | -------- | ----------- |
176-
| `host` | string | Yes | PostgreSQL server hostname or IP address |
177-
| `port` | number | Yes | PostgreSQL server port \(default: 5432\) |
178-
| `database` | string | Yes | Database name to connect to |
179-
| `username` | string | Yes | Database username |
180-
| `password` | string | Yes | Database password |
181-
| `ssl` | string | No | SSL connection mode \(disabled, required, preferred\) |
182146
| `schema` | string | No | Schema to introspect \(default: public\) |
183147

184148
#### Output

‎apps/sim/blocks/blocks/mssql.ts‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { getErrorMessage } from '@sim/utils/errors'
22
import { MicrosoftSqlIcon } from '@/components/icons'
33
import type { BlockConfig, BlockMeta } from '@/blocks/types'
4-
import { IntegrationType } from '@/blocks/types'
4+
import { AuthMode, IntegrationType } from '@/blocks/types'
5+
import { withSavedCredential } from '@/blocks/utils'
56

67
const MSSQL_WAND_PROMPT = `You are an expert Microsoft SQL Server developer. Write T-SQL queries based on the user's request.
78
@@ -67,6 +68,8 @@ Return ONLY the SQL query - no explanations, no markdown, no extra text.`
6768

6869
export const MSSQLBlock: BlockConfig = {
6970
type: 'mssql',
71+
hideFromToolbar: true,
72+
sunset: { status: 'legacy', replacedBy: 'mssql_v2' },
7073
name: 'Microsoft SQL Server',
7174
description: 'Connect to Microsoft SQL Server database',
7275
longDescription: 'Query, insert, update, delete, execute raw T-SQL, and introspect schemas.',
@@ -406,6 +409,46 @@ export const MSSQLBlock: BlockConfig = {
406409
},
407410
}
408411

412+
/**
413+
* Microsoft SQL Server on a saved connection: host, port, database, login, password, and
414+
* transport-security settings come from the credential, never the block.
415+
*/
416+
export const MSSQLV2Block: BlockConfig = {
417+
...MSSQLBlock,
418+
type: 'mssql_v2',
419+
authMode: AuthMode.OAuth,
420+
hideFromToolbar: false,
421+
sunset: undefined,
422+
canvasPresentation: {
423+
defaultTitle: 'Microsoft SQL Server',
424+
sentences: {
425+
byOperation: {
426+
query: [{ text: 'Run SELECT query', field: 'query', core: true }],
427+
insert: [
428+
{ text: 'Insert', field: 'data', core: true },
429+
{ text: 'into', field: 'table', core: true },
430+
],
431+
update: [
432+
{ text: 'Update rows in', field: 'table', core: true },
433+
{ text: ', where', field: 'where' },
434+
{ text: ', setting', field: 'data' },
435+
],
436+
delete: [
437+
{ text: 'Delete rows from', field: 'table', core: true },
438+
{ text: ', where', field: 'where' },
439+
],
440+
execute: [{ text: 'Execute raw T-SQL', field: 'query', core: true }],
441+
introspect: ['Read the database schema', { text: ', under', field: 'schema' }],
442+
},
443+
},
444+
},
445+
...withSavedCredential(
446+
MSSQLBlock,
447+
{ id: 'credential', type: 'oauth-input', serviceId: 'mssql', title: 'SQL Server Connection' },
448+
{ required: true }
449+
),
450+
}
451+
409452
export const MSSQLBlockMeta = {
410453
tags: ['data-analytics'],
411454
url: 'https://www.microsoft.com/en-us/sql-server',

0 commit comments

Comments
 (0)