mirror of
https://github.com/knex/knex.git
synced 2025-06-26 22:00:25 +00:00

* Fixed float type of mssql to be float * Many tests where postgres test was not actually ran at all * Migrations to be mssql compatible Mssql driver doesn't handle if multiple queries are sent to same transaction concurrently. * Prevented mssql failing when invalid schema builder was executed by accident Instead of trying to generate sql from broken schema calls, just make exception to leak before query compiling is started * Fixed mssql trx rollback to always throw an error Also modified some connection test query to be mssql compatible * Fixed various bugs from MSSQL driver to make tests run * Fixed mssql unique index to be compatible with other dialect implementations * Enable running mssql tests on CI * Test for #2588 * Updated tests to not be dependend on tables left from previous test rans * Trying to make mssql server work on travis
51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
var Connection = require('tedious').Connection;
|
|
|
|
var config = {
|
|
userName: "sa",
|
|
password: "S0meVeryHardPassword",
|
|
server: "localhost",
|
|
options: {
|
|
database: "knex_test",
|
|
}
|
|
};
|
|
|
|
let didConnect = false;
|
|
let tryCount = 0;
|
|
|
|
function tryToConnect() {
|
|
tryCount++;
|
|
if (tryCount > 50) {
|
|
console.log("Giving up... it fails if it fails");
|
|
process.exit(0);
|
|
}
|
|
|
|
console.log("Connecting... to mssql");
|
|
|
|
var connection = new Connection(config);
|
|
|
|
connection.on('end', () => {
|
|
if (!didConnect) {
|
|
console.log("Couldnt connnect yet... try again in two secs...");
|
|
setTimeout(tryToConnect, 2000);
|
|
}
|
|
});
|
|
|
|
connection.on('error', () => {
|
|
// prevent leaking errors.. driver seems to sometimes emit error event,
|
|
// sometimes connect event with error
|
|
// and some times just closes connection without error / connect events
|
|
// (debug event says that socket was ended and thats it...)
|
|
});
|
|
|
|
connection.on('connect', (err) => {
|
|
if (!err) {
|
|
console.log("Connecting mssql server was a great success!");
|
|
didConnect = true;
|
|
} else {
|
|
console.log("Error was passed to connect event.");
|
|
}
|
|
connection.close();
|
|
});
|
|
}
|
|
|
|
tryToConnect(); |