-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
What was unclear or otherwise insufficient?
data-source-options.md defines connection settings for a variety of data sources, among which is MSSQL.
Data Source Option pool.testOnBorrow indicates that factory.validate or factory.validateAsync is required if this field is used.
The Option pool.testOnBorrow appears to fail silently if the required factory.validate or factory.validateAsync isn't provided.
The options factory.validate or factory.validateAsync are not defined anywhere in data-source-options.md
Recommended Fix
Provide a definition for factory.validate or factory.validateAsync in data-source-options.md to clarify the following:
- Where exactly the option is to be added
- What is the acceptable value of this (bool?)
- Perhaps a common example
For instance:
# factory.validate example
export const AppDataSource = new DataSource({
type: "mssql",
host: process.env.dbhost,
port: process.env.dbport,
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 30000,
acquireTimeoutMillis: 30000,
testOnBorrow: true,
},
factory: {
validate: async (connection) => {
try {
await connection.query("SELECT 1");
} catch (e) {
console.error(e);
return false;
}
return true;
}
}
})Additional Context
Google searches, stackoverflow searches, GitHub searches and stackoverflow searches did not help to resolve this issue or give adequate typeorm specific details.
Also noting the typeorm slack channel link is dead.
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.