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.onSubmit - Callback when connection is successfully validated and saved
* @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
* @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,
port: existingConnection.port,
database: existingConnection.database,
scheme: existingConnection.scheme,
schema: existingConnection.schema,
encrypt: existingConnection?.encrypt,
});
} else {
@ -139,6 +139,7 @@ export default function SQLConnectionModal({
host: form.get("host").trim(),
port: form.get("port").trim(),
database: form.get("database").trim(),
schema: form.get("schema")?.trim() || null,
encrypt: form.get("encrypt") === "true",
});
}
@ -217,6 +218,7 @@ export default function SQLConnectionModal({
engine,
database_id: slugifiedDatabaseId,
connectionString,
schema: engine === "postgresql" ? config.schema : null,
};
if (isEditMode) {

View File

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