fix schema not persisting in DB connector

This commit is contained in:
Timothy Carambat 2026-03-11 11:43:38 -07:00
parent 7dd7d57a8f
commit 6713c80f31
2 changed files with 7 additions and 2 deletions

View File

@ -79,7 +79,7 @@ const DEFAULT_CONFIG = {
* @param {Function} props.closeModal - Callback to close the modal * @param {Function} props.closeModal - Callback to close the modal
* @param {Function} props.onSubmit - Callback when connection is successfully validated and saved * @param {Function} props.onSubmit - Callback when connection is successfully validated and saved
* @param {Function} props.setHasChanges - Callback to mark that changes have been made * @param {Function} props.setHasChanges - Callback to mark that changes have been made
* @param {Object|null} [props.existingConnection=null] - Existing connection data for edit mode (contains database_id, engine, username, password, host, port, database, scheme, encrypt) * @param {Object|null} [props.existingConnection=null] - Existing connection data for edit mode (contains database_id, engine, username, password, host, port, database, schema, encrypt)
* @param {Array} [props.connections=[]] - List of all existing connections for duplicate detection * @param {Array} [props.connections=[]] - List of all existing connections for duplicate detection
* @returns {React.ReactPortal|null} - Portal containing the modal UI, or null if not open * @returns {React.ReactPortal|null} - Portal containing the modal UI, or null if not open
*/ */
@ -110,7 +110,7 @@ export default function SQLConnectionModal({
host: existingConnection.host, host: existingConnection.host,
port: existingConnection.port, port: existingConnection.port,
database: existingConnection.database, database: existingConnection.database,
scheme: existingConnection.scheme, schema: existingConnection.schema,
encrypt: existingConnection?.encrypt, encrypt: existingConnection?.encrypt,
}); });
} else { } else {
@ -139,6 +139,7 @@ export default function SQLConnectionModal({
host: form.get("host").trim(), host: form.get("host").trim(),
port: form.get("port").trim(), port: form.get("port").trim(),
database: form.get("database").trim(), database: form.get("database").trim(),
schema: form.get("schema")?.trim() || null,
encrypt: form.get("encrypt") === "true", encrypt: form.get("encrypt") === "true",
}); });
} }
@ -217,6 +218,7 @@ export default function SQLConnectionModal({
engine, engine,
database_id: slugifiedDatabaseId, database_id: slugifiedDatabaseId,
connectionString, connectionString,
schema: engine === "postgresql" ? config.schema : null,
}; };
if (isEditMode) { if (isEditMode) {

View File

@ -789,6 +789,7 @@ function mergeConnections(existingConnections = [], updates = []) {
originalDatabaseId, originalDatabaseId,
connectionString, connectionString,
engine, engine,
schema,
} = update; } = update;
switch (action) { switch (action) {
@ -822,6 +823,7 @@ function mergeConnections(existingConnections = [], updates = []) {
engine, engine,
database_id: newId, database_id: newId,
connectionString, connectionString,
...(schema && { schema }),
}); });
break; break;
} }
@ -842,6 +844,7 @@ function mergeConnections(existingConnections = [], updates = []) {
engine, engine,
database_id: slugifiedId, database_id: slugifiedId,
connectionString, connectionString,
...(schema && { schema }),
}); });
break; break;
} }