Refactor database credential handling across adapters

- Updated all database adapter tests and implementations to replace the 'database' field with 'default_database' for consistency.
- Ensured backward compatibility in the Redshift adapter by allowing both 'database' and 'default_database' fields.
- Enhanced SQLServer and MySQL adapters to reflect the new credential structure, improving clarity and maintainability.
This commit is contained in:
dal 2025-08-24 23:35:46 -06:00
parent 210fa646b1
commit 2e24d830f0
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
14 changed files with 73 additions and 64 deletions

View File

@ -66,7 +66,7 @@ describe('Adapter Factory', () => {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
port: 3306, port: 3306,
database: 'test', default_database: 'test',
username: 'user', username: 'user',
password: 'pass', password: 'pass',
}; };
@ -80,7 +80,7 @@ describe('Adapter Factory', () => {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
port: 1433, port: 1433,
database: 'test', default_database: 'test',
username: 'user', username: 'user',
password: 'pass', password: 'pass',
}; };

View File

@ -36,7 +36,7 @@ describe('MySQLAdapter Integration', () => {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: process.env.TEST_MYSQL_HOST || 'localhost', host: process.env.TEST_MYSQL_HOST || 'localhost',
port: Number(process.env.TEST_MYSQL_PORT) || 3306, port: Number(process.env.TEST_MYSQL_PORT) || 3306,
database: process.env.TEST_MYSQL_DATABASE!, default_database: process.env.TEST_MYSQL_DATABASE!,
username: process.env.TEST_MYSQL_USERNAME!, username: process.env.TEST_MYSQL_USERNAME!,
password: process.env.TEST_MYSQL_PASSWORD!, password: process.env.TEST_MYSQL_PASSWORD!,
ssl: process.env.TEST_MYSQL_SSL === 'true', ssl: process.env.TEST_MYSQL_SSL === 'true',
@ -56,7 +56,7 @@ describe('MySQLAdapter Integration', () => {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: process.env.TEST_MYSQL_HOST || 'localhost', host: process.env.TEST_MYSQL_HOST || 'localhost',
port: Number(process.env.TEST_MYSQL_PORT) || 3306, port: Number(process.env.TEST_MYSQL_PORT) || 3306,
database: process.env.TEST_MYSQL_DATABASE!, default_database: process.env.TEST_MYSQL_DATABASE!,
username: process.env.TEST_MYSQL_USERNAME!, username: process.env.TEST_MYSQL_USERNAME!,
password: process.env.TEST_MYSQL_PASSWORD!, password: process.env.TEST_MYSQL_PASSWORD!,
ssl: process.env.TEST_MYSQL_SSL === 'true', ssl: process.env.TEST_MYSQL_SSL === 'true',
@ -80,7 +80,7 @@ describe('MySQLAdapter Integration', () => {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: process.env.TEST_MYSQL_HOST || 'localhost', host: process.env.TEST_MYSQL_HOST || 'localhost',
port: Number(process.env.TEST_MYSQL_PORT) || 3306, port: Number(process.env.TEST_MYSQL_PORT) || 3306,
database: process.env.TEST_MYSQL_DATABASE!, default_database: process.env.TEST_MYSQL_DATABASE!,
username: process.env.TEST_MYSQL_USERNAME!, username: process.env.TEST_MYSQL_USERNAME!,
password: process.env.TEST_MYSQL_PASSWORD!, password: process.env.TEST_MYSQL_PASSWORD!,
ssl: process.env.TEST_MYSQL_SSL === 'true', ssl: process.env.TEST_MYSQL_SSL === 'true',
@ -106,7 +106,7 @@ describe('MySQLAdapter Integration', () => {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: process.env.TEST_MYSQL_HOST || 'localhost', host: process.env.TEST_MYSQL_HOST || 'localhost',
port: Number(process.env.TEST_MYSQL_PORT) || 3306, port: Number(process.env.TEST_MYSQL_PORT) || 3306,
database: process.env.TEST_MYSQL_DATABASE!, default_database: process.env.TEST_MYSQL_DATABASE!,
username: process.env.TEST_MYSQL_USERNAME!, username: process.env.TEST_MYSQL_USERNAME!,
password: process.env.TEST_MYSQL_PASSWORD!, password: process.env.TEST_MYSQL_PASSWORD!,
ssl: process.env.TEST_MYSQL_SSL === 'true', ssl: process.env.TEST_MYSQL_SSL === 'true',
@ -130,7 +130,7 @@ describe('MySQLAdapter Integration', () => {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'invalid-host', host: 'invalid-host',
port: 3306, port: 3306,
database: 'invalid-db', default_database: 'invalid-db',
username: 'invalid-user', username: 'invalid-user',
password: 'invalid-pass', password: 'invalid-pass',
}; };

View File

@ -34,7 +34,7 @@ describe('MySQLAdapter', () => {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
port: 3306, port: 3306,
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -54,7 +54,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -72,7 +72,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
ssl: { rejectUnauthorized: true }, ssl: { rejectUnauthorized: true },
@ -91,7 +91,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
connection_timeout: 5000, connection_timeout: 5000,
@ -110,7 +110,7 @@ describe('MySQLAdapter', () => {
const credentials = { const credentials = {
type: DataSourceType.PostgreSQL, type: DataSourceType.PostgreSQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -124,7 +124,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -270,7 +270,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -289,7 +289,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -307,7 +307,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -322,7 +322,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -341,7 +341,7 @@ describe('MySQLAdapter', () => {
const credentials: MySQLCredentials = { const credentials: MySQLCredentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };

View File

@ -20,7 +20,7 @@ export class MySQLAdapter extends BaseAdapter {
const config: mysql.ConnectionOptions = { const config: mysql.ConnectionOptions = {
host: mysqlCredentials.host, host: mysqlCredentials.host,
port: mysqlCredentials.port || 3306, port: mysqlCredentials.port || 3306,
database: mysqlCredentials.database, database: mysqlCredentials.default_database,
user: mysqlCredentials.username, user: mysqlCredentials.username,
password: mysqlCredentials.password, password: mysqlCredentials.password,
}; };

View File

@ -43,6 +43,7 @@ describe('PostgreSQLAdapter', () => {
database: 'testdb', database: 'testdb',
user: 'testuser', user: 'testuser',
password: 'testpass', password: 'testpass',
ssl: true,
}); });
expect(mockClient.connect).toHaveBeenCalled(); expect(mockClient.connect).toHaveBeenCalled();
}); });

View File

@ -48,10 +48,8 @@ export class PostgreSQLAdapter extends BaseAdapter {
password: pgCredentials.password, password: pgCredentials.password,
}; };
// Handle SSL configuration // Handle SSL configuration - default to true for security
if (pgCredentials.ssl !== undefined) { config.ssl = pgCredentials.ssl ?? true;
config.ssl = pgCredentials.ssl;
}
// Handle connection timeout // Handle connection timeout
if (pgCredentials.connection_timeout) { if (pgCredentials.connection_timeout) {

View File

@ -33,7 +33,7 @@ describe('RedshiftAdapter', () => {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.region.redshift.amazonaws.com', host: 'cluster.region.redshift.amazonaws.com',
port: 5439, port: 5439,
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -56,7 +56,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -74,7 +74,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -92,7 +92,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
ssl: false, ssl: false,
@ -116,7 +116,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
ssl: sslOptions, ssl: sslOptions,
@ -135,7 +135,7 @@ describe('RedshiftAdapter', () => {
const credentials = { const credentials = {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -149,7 +149,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -166,7 +166,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -350,7 +350,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -369,7 +369,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -387,7 +387,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -402,7 +402,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -421,7 +421,7 @@ describe('RedshiftAdapter', () => {
const credentials: RedshiftCredentials = { const credentials: RedshiftCredentials = {
type: DataSourceType.Redshift, type: DataSourceType.Redshift,
host: 'cluster.redshift.amazonaws.com', host: 'cluster.redshift.amazonaws.com',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };

View File

@ -31,10 +31,19 @@ export class RedshiftAdapter extends BaseAdapter {
const redshiftCredentials = credentials as RedshiftCredentials; const redshiftCredentials = credentials as RedshiftCredentials;
try { try {
// Handle both 'database' and 'default_database' for backward compatibility
const database = redshiftCredentials.default_database;
if (!database) {
throw new Error(
'Database name is required. Please provide either "database" or "default_database" in credentials.'
);
}
const config: ClientConfig = { const config: ClientConfig = {
host: redshiftCredentials.host, host: redshiftCredentials.host,
port: redshiftCredentials.port || 5439, // Default Redshift port port: redshiftCredentials.port || 5439, // Default Redshift port
database: redshiftCredentials.database, database: database,
user: redshiftCredentials.username, user: redshiftCredentials.username,
password: redshiftCredentials.password, password: redshiftCredentials.password,
ssl: redshiftCredentials.ssl ?? true, // SSL is typically required for Redshift ssl: redshiftCredentials.ssl ?? true, // SSL is typically required for Redshift
@ -43,9 +52,10 @@ export class RedshiftAdapter extends BaseAdapter {
// Handle connection timeout - default to 60 seconds for serverless // Handle connection timeout - default to 60 seconds for serverless
config.connectionTimeoutMillis = redshiftCredentials.connection_timeout || 60000; config.connectionTimeoutMillis = redshiftCredentials.connection_timeout || 60000;
// Set default schema if provided // Set default schema if provided (handle both 'schema' and 'default_schema')
if (redshiftCredentials.schema) { const schema = redshiftCredentials.default_schema;
config.options = `-c search_path=${redshiftCredentials.schema}`; if (schema) {
config.options = `-c search_path=${schema}`;
} }
this.client = new Client(config); this.client = new Client(config);

View File

@ -36,7 +36,7 @@ describe('SQLServerAdapter Integration', () => {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: process.env.TEST_SQLSERVER_SERVER || 'localhost', server: process.env.TEST_SQLSERVER_SERVER || 'localhost',
port: Number(process.env.TEST_SQLSERVER_PORT) || 1433, port: Number(process.env.TEST_SQLSERVER_PORT) || 1433,
database: process.env.TEST_SQLSERVER_DATABASE!, default_database: process.env.TEST_SQLSERVER_DATABASE!,
username: process.env.TEST_SQLSERVER_USERNAME!, username: process.env.TEST_SQLSERVER_USERNAME!,
password: process.env.TEST_SQLSERVER_PASSWORD!, password: process.env.TEST_SQLSERVER_PASSWORD!,
trust_server_certificate: process.env.TEST_SQLSERVER_TRUST_CERT === 'true', trust_server_certificate: process.env.TEST_SQLSERVER_TRUST_CERT === 'true',
@ -56,7 +56,7 @@ describe('SQLServerAdapter Integration', () => {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: process.env.TEST_SQLSERVER_SERVER || 'localhost', server: process.env.TEST_SQLSERVER_SERVER || 'localhost',
port: Number(process.env.TEST_SQLSERVER_PORT) || 1433, port: Number(process.env.TEST_SQLSERVER_PORT) || 1433,
database: process.env.TEST_SQLSERVER_DATABASE!, default_database: process.env.TEST_SQLSERVER_DATABASE!,
username: process.env.TEST_SQLSERVER_USERNAME!, username: process.env.TEST_SQLSERVER_USERNAME!,
password: process.env.TEST_SQLSERVER_PASSWORD!, password: process.env.TEST_SQLSERVER_PASSWORD!,
trust_server_certificate: process.env.TEST_SQLSERVER_TRUST_CERT === 'true', trust_server_certificate: process.env.TEST_SQLSERVER_TRUST_CERT === 'true',
@ -80,7 +80,7 @@ describe('SQLServerAdapter Integration', () => {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: process.env.TEST_SQLSERVER_SERVER || 'localhost', server: process.env.TEST_SQLSERVER_SERVER || 'localhost',
port: Number(process.env.TEST_SQLSERVER_PORT) || 1433, port: Number(process.env.TEST_SQLSERVER_PORT) || 1433,
database: process.env.TEST_SQLSERVER_DATABASE!, default_database: process.env.TEST_SQLSERVER_DATABASE!,
username: process.env.TEST_SQLSERVER_USERNAME!, username: process.env.TEST_SQLSERVER_USERNAME!,
password: process.env.TEST_SQLSERVER_PASSWORD!, password: process.env.TEST_SQLSERVER_PASSWORD!,
trust_server_certificate: process.env.TEST_SQLSERVER_TRUST_CERT === 'true', trust_server_certificate: process.env.TEST_SQLSERVER_TRUST_CERT === 'true',
@ -106,7 +106,7 @@ describe('SQLServerAdapter Integration', () => {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: process.env.TEST_SQLSERVER_SERVER || 'localhost', server: process.env.TEST_SQLSERVER_SERVER || 'localhost',
port: Number(process.env.TEST_SQLSERVER_PORT) || 1433, port: Number(process.env.TEST_SQLSERVER_PORT) || 1433,
database: process.env.TEST_SQLSERVER_DATABASE!, default_database: process.env.TEST_SQLSERVER_DATABASE!,
username: process.env.TEST_SQLSERVER_USERNAME!, username: process.env.TEST_SQLSERVER_USERNAME!,
password: process.env.TEST_SQLSERVER_PASSWORD!, password: process.env.TEST_SQLSERVER_PASSWORD!,
trust_server_certificate: process.env.TEST_SQLSERVER_TRUST_CERT === 'true', trust_server_certificate: process.env.TEST_SQLSERVER_TRUST_CERT === 'true',
@ -130,7 +130,7 @@ describe('SQLServerAdapter Integration', () => {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'invalid-host', server: 'invalid-host',
port: 1433, port: 1433,
database: 'invalid-db', default_database: 'invalid-db',
username: 'invalid-user', username: 'invalid-user',
password: 'invalid-pass', password: 'invalid-pass',
}; };

View File

@ -51,7 +51,7 @@ describe('SQLServerAdapter', () => {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
port: 1433, port: 1433,
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -76,7 +76,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -94,7 +94,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
encrypt: false, encrypt: false,
@ -131,7 +131,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -148,7 +148,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -367,7 +367,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -414,7 +414,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -435,7 +435,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -453,7 +453,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -468,7 +468,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };
@ -487,7 +487,7 @@ describe('SQLServerAdapter', () => {
const credentials: SQLServerCredentials = { const credentials: SQLServerCredentials = {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: 'localhost', server: 'localhost',
database: 'testdb', default_database: 'testdb',
username: 'testuser', username: 'testuser',
password: 'testpass', password: 'testpass',
}; };

View File

@ -27,7 +27,7 @@ export class SQLServerAdapter extends BaseAdapter {
const config: sql.config = { const config: sql.config = {
server: sqlServerCredentials.server, server: sqlServerCredentials.server,
port: sqlServerCredentials.port, port: sqlServerCredentials.port,
database: sqlServerCredentials.database, database: sqlServerCredentials.default_database,
user: sqlServerCredentials.username, user: sqlServerCredentials.username,
password: sqlServerCredentials.password, password: sqlServerCredentials.password,
options: { options: {

View File

@ -103,7 +103,7 @@ describe('DataSource Unit Tests', () => {
credentials: { credentials: {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'test', default_database: 'test',
username: 'user', username: 'user',
password: 'pass', password: 'pass',
}, },
@ -714,7 +714,7 @@ describe('DataSource Unit Tests', () => {
credentials: { credentials: {
type: DataSourceType.MySQL, type: DataSourceType.MySQL,
host: 'localhost', host: 'localhost',
database: 'test', default_database: 'test',
username: 'user', username: 'user',
password: 'pass', password: 'pass',
}, },

View File

@ -19,7 +19,7 @@ function createSQLServerCredentials(): SQLServerCredentials {
type: DataSourceType.SQLServer, type: DataSourceType.SQLServer,
server: testConfig.sqlserver.server, server: testConfig.sqlserver.server,
port: testConfig.sqlserver.port, port: testConfig.sqlserver.port,
database: testConfig.sqlserver.database, default_database: testConfig.sqlserver.database,
username: testConfig.sqlserver.username, username: testConfig.sqlserver.username,
password: testConfig.sqlserver.password, password: testConfig.sqlserver.password,
encrypt: testConfig.sqlserver.encrypt, encrypt: testConfig.sqlserver.encrypt,

View File

@ -119,7 +119,7 @@ export interface MySQLCredentials {
port?: number; port?: number;
/** Database name */ /** Database name */
database: string; default_database: string;
/** Username for authentication */ /** Username for authentication */
username: string; username: string;
@ -158,7 +158,7 @@ export interface SQLServerCredentials {
port?: number; port?: number;
/** Database name */ /** Database name */
database: string; default_database: string;
/** Username for authentication */ /** Username for authentication */
username: string; username: string;
@ -199,7 +199,7 @@ export interface RedshiftCredentials {
port?: number; port?: number;
/** Database name */ /** Database name */
database: string; default_database: string;
/** Username for authentication */ /** Username for authentication */
username: string; username: string;
@ -208,7 +208,7 @@ export interface RedshiftCredentials {
password: string; password: string;
/** Default schema to use */ /** Default schema to use */
schema?: string; default_schema?: string;
/** SSL configuration (required for Redshift) */ /** SSL configuration (required for Redshift) */
ssl?: boolean; ssl?: boolean;