feat: firebird use attachOrCreate on connect, add dbFileExtension and locaiton on server to tests

This commit is contained in:
Pavel
2025-05-15 15:04:54 +02:00
parent 7ac6cfcf25
commit 951bfa23f3
7 changed files with 54 additions and 17 deletions

View File

@@ -5,7 +5,12 @@ const crypto = require('crypto');
function randomDbName(dialect) {
const generatedKey = crypto.randomBytes(6);
const newKey = generatedKey.toString('hex');
const res = `db${newKey}`;
let res = `db${newKey}`;
if (dialect.dbFileExtension) {
res += dialect.dbFileExtension;
}
if (dialect.upperCaseAllDbObjectNames) return res.toUpperCase();
return res;
}
@@ -17,7 +22,7 @@ async function connect(engine, database) {
if (engine.generateDbFile) {
const conn = await driver.connect({
...connection,
databaseFile: `dbtemp/${database}`,
databaseFile: (engine.databaseFileLocationOnServer ?? 'dbtemp/') + database,
});
return conn;
} else {