62 Commits

Author SHA1 Message Date
Jake Coffman
d50d00644c
oracledb: commit was a no-op causing race conditions (#3668)
The underlying issue was that query *always* committed, even during a transaction. The previous fix was to just disable commitAsync in a transaction but then that also disabled explicit commit calls. Instead, this fix disables query's commits during transactions so that explicit commits still work.
2020-02-16 20:26:13 +01:00
maximelkin
88d832cd36
replace Bluebird.timeout (#3634) 2020-02-12 21:42:15 +01:00
Martti Laine
5417cacdb1 Fix for concurrent child transactions failing (#2213) (#3440)
* Fix for concurrent child transactions failing (#2213)

* Skip new sibling transaction test for mssql

* Update test to ensure Promise resolve order
2019-09-20 14:37:58 +02:00
Igor Savin
e971c5198b
Update dependencies, fix new eslint errors (#3339) 2019-07-10 20:47:56 +02:00
Dmitrii Maganov
a0e9be548d Fix return duplicate transaction promise for standalone transactions (#3328) 2019-07-04 22:05:23 +02:00
Igor Savin
4a631a3c00
Do not reject promise on transaction rollback (#3235) 2019-06-21 12:56:00 +02:00
Igor Savin
1e950b93e4
Name Bluebird usage explicitly. Remove spread and thenReturn (#3285) 2019-06-17 02:14:17 +02:00
Igor Savin
4b6429ebf9
Reduce bluebird usage (#3267) 2019-06-08 02:34:41 +02:00
Igor Savin
c431ffc35a
Drop support for Node.js 6. Remove babel. (#3227) 2019-06-04 00:37:17 +02:00
Igor Savin
5307dacc66
Implement support for returning started transaction without using transaction() methods callback function (#3099) 2019-05-26 18:03:07 -07:00
Mikael Lepistö
8a9a648ae2
Docker based test dbs (#3157)
* Fixed some of the tests failing with various dialect combinations

* Setup all test databases to run in docker

* Fixed test suite and updated travis to use docker

* Fixed some tests in master and disabled oracle tests while setting everything else to work again

* Changed docker to use latest postgresql alpine image

* Re-enabled all oracledb tests

* Install oracle client libs to oracle server and copy them to travis to make node oracledb package to work

* Disabled random failing oracle tests and added test to show that oracle update in transaction does not seem to work ACID

* Update package.json

* Update package.json

* Fixed linting issues

* Fixed waiting for postgres to use the same DB image that database is using.

* Removed installing oracledb driver in travis if not needed .travis.yml

* Cleaned up package.json more

* Created static name for oracledb container to allow copying files out of it on different docker versions

* Removed webpack from deps
2019-05-13 12:21:36 +03:00
Igor Savin
26868f864c Fix event listener duplication (#2982)
* Fix event listener duplication. Start executing more tests in CI; fix broken test.

* Fix listener

* Fix listener

* Fix Node 6 support

* There doesn't seem to be a clear way to fix listener behaviour in Node 6, so let's just ignore it for the time being, especially considering that we are dropping support for Node 6 in April anyway.

* Update migration guide
2019-01-31 07:23:05 +02:00
Henry Williams
2611e5a300 Fix linter errors in tests (#2859)
* fix lint errors for tests
2018-10-15 22:29:53 -04:00
Tim Griesser
232fe9f151
Add Prettier (#2697)
* Add prettier
* Run files through prettier
2018-07-09 08:10:34 -04:00
Mikael Lepistö
cb3a85e738
Normalized and validated driverNames of test db clients and fixed oracle test setup (#2692)
* Normalized and validated driverNames of test db clients and fixed oracle test setup

* Fixed failed queries from old query building tests which hadn't been ran in ages

* Allow selecting node version which is used to run oracledb docker tests

* Improved sql tester error messages

* Fixed rest of the oracledb tests

* Removed invalid flag from docker-compose

* Print mssql logs if initialization fails

* Fixed syntax error + final tests

* Added restart of failure for mssql DB initialization to try again if server was not ready

* Printout always mssql logs after container is started

* Fixed wait time printing after trying to connect

* Use npm run oracledb:test for testing oracle in travis
2018-07-08 14:10:51 +03:00
Mikael Lepistö
b349ac4a8c
Various fixes to mssql dialect (#2653)
* 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
2018-06-29 10:47:06 +03:00
Simon Lidén
397104c3dc
Added knexTxId to query events and debug calls (#2476)
* Added knexTxId to query events and debug calls

* Added __knexTxId to oracle transactions

* Set knexTxId also in oracledb
2018-02-21 13:26:59 +01:00
nico
522ccba8f7 Checks for an empty, undefined or null object on transacting (#2494)
* Checks for an empty, undefined or null object on transacting

Fixes https://github.com/tgriesser/knex/issues/2079

Those values indicates that the developer probably made a mistake.

* Fix message assertions
2018-02-20 11:41:21 +02:00
Adam Cofer
5f81e8aeb9 Add redshift support without changing cli or package.json (#2233)
* Add a Redshift dialect that inherits from Postgres.

* Turn .index() and .dropIndex() into no-ops with warnings in the Redshift dialect.

* Update the Redshift dialect to be compatible with master.

* Update package.json

* Disable liftoff cli

* Remove the CLI

* Add lib to the repo

* Allow the escaping of named bindings.

* Update dist

* Update the Redshift dialect’s instantiation of the query and column compilers.

* Update the distribution

* Fix a merge conflict

* Take lib back out

* Trying to bring back in line with tgreisser/knex

* Add npm 5 package-lock

* Bring cli.js back in line

* Bring cli.js back in line

* Progress commit on redshift integration tests

* Revert "Progress commit on redshift integration tests"

This reverts commit 207e31635c638853dec54ce0580d34559ba5a54c.

* Progress commit

* Working not null on primary columns in createTable

* Working redshift unit tests

* Working unit and integration tests, still need to fix migration tests

* Brought datatypes more in line with what redshift actually supports

* Added query compiler unit tests

* Add a hacky returning clause for redshift ugh

* Working migration integration tests

* Working insert integration tests

* Allow multiple insert returning values

* Working select integration tests

* Working join integration tests

* Working aggregate integration tests

* All integration suite tests working

* Put docker index for reconnect tests back

* Redshift does not support insert...returning, there does not seem to be a way around that, therefore accept it and test accordingly

* Leave redshift integration tests in place, but do not run them by default

* Fix mysql order by test

* Fix more tests

* Change test db name to knex_test for consistency

* Address PR comments
2018-02-03 15:33:02 +02:00
Joel Mukuthu
bf1fa63118 Add queryContext to schema and query builders (#2314)
* feat(query-builder): add hookContext for wrapIdentifier

* refactor: use isUndefined

* test(transaction): test passing of hookContext

* feat(runnner): pass context to postProcessResponse

* test(runner): test postProcessResponse for raw responses

* test(raw): test passing of hookContext

* feat: add hookContext to Raw and SchemaBuilder

* test(transaction): fix test for hookContext

* chore: fix lint error

* fix: check for hookContext before calling it

* test(transaction): fix hookContext test

* chore: remove whitespace

* test(hookContext): test cloning of context object

* refactor: hookContext -> queryContext

* minor: use more descriptive variable name

i.e. refactor: `context` => `queryContext`

* fix: remove unnecessary checks for query builder

* fix(Raw): pass query builder to formatter

* fix(SchemaCompiler): pass schema builder to formatter

* refactor: add addQueryContext helper

* feat: add queryContext to TableBuilder and ColumnBuilder

* fix(TableCompiler): pass table builder to formatter

* fix(ColumnCompiler): pass column builder to formatter

* fix(pushQuery): fix passing builder to formatter

* test(Schema|Table|ColumnCompiler): test passing queryContext

* fix(SchemaCompiler): pass queryContext to TableCompiler

* fix(TableCompiler): pass queryContext to ColumnCompiler

* test: add queryContext tests for all schema dialects

* test(TableCompiler): test overwriting queryContext from SchemaCompiler

* test(Raw): test passing queryContext to wrapIdentifier

* tests: run all the tests
2018-02-02 00:41:01 +02:00
Mikael Lepistö
9682446e08 Fixed transaction promise mutation issue (#1991)
* Fixed transaction promise to not be overridden

* Disabled failing test case until #1970 feature if fixed.
2017-03-26 19:43:36 +03:00
wubzz
138e13b8b1 Bugfixes on batchInsert and transactions for mysql/maria (#1992) 2017-03-26 18:43:17 +03:00
wubzz
b722753ea3 Transaction should not reject with undefined. (#1970) 2017-03-14 21:56:32 +01:00
Justin Huntington
2fa375f813 Pass rollback errors through to transaction promise in mssql dialect (#1884) (#1885)
Check for rollback failures on mssql and pass them through to the transaction promise-- attaching the underlying cause as an 'originalError' property.  This fixes a hang when mssql server aborts a transaction and the client issues a rollback.
2017-01-30 15:00:03 -06:00
Alexandre Tiertant
3609de76b3 fix oracle tests (#1741)
* Fix Oracle dialect to pass integration tests$

* Update transaction.js

* fix oracle timeout request

* Enabled travis-oracledb-xe installer

Signed-off-by: Alexandre Tiertant <a.tiertant@atlantis-software.net>

* fix timeout tests

* fix timeout tests messages
2016-10-14 18:00:39 +03:00
Tim Griesser
454b769a10 Fix test suite for node 0.12 2016-10-09 18:26:04 -04:00
Tim Griesser
188796554e Fix test suite for node 0.12 2016-10-09 17:51:13 -04:00
Tim Griesser
dc431f8afc Fix test for acquireConnectionTimeout 2016-10-09 17:33:52 -04:00
Tim Griesser
3a3cad9f88 Fix #1694 2016-10-09 14:33:51 -04:00
Tim Griesser
f5bad1ae54 Simplifying internal client structure 2016-09-13 08:15:58 -04:00
Jurko Gospodnetić
85b780d4fa sync test comments about oracle & mssql not reporting BEGIN/ROLLBACK as queries 2016-03-08 07:50:19 +01:00
wubzz
4244bb1ec2 Simplify the test and lower the time to 1sec 2016-02-03 22:50:45 +01:00
wubzz
57bac6cd58 Fix some indentation and test comment 2016-02-01 21:27:30 +01:00
wubzz
80ee5a8021 select version() => select 1 = 1 for test
version() doesn't exist in all dbs.
2016-02-01 20:54:14 +01:00
wubzz
eea94a8896 TimeoutError when acquiring con is not possible 2016-02-01 20:40:06 +01:00
Sky Morey
afd6b66624 Final build of mssql provider, all tests pass 2015-12-09 17:53:53 -06:00
wubzz
0d628ebf0f Fix typo tr === trx 2015-09-23 19:32:27 +02:00
wubzz
d60dd74f27 Attempt to add test for #855 2015-09-20 15:29:07 +02:00
Tim Griesser
470428032d Fix #832, errors thrown in trx container trigger rejection 2015-05-20 11:19:12 -04:00
Tim Griesser
2e47b9d2e8 Nicer query builder interface 2015-04-28 09:14:13 -04:00
Tim Griesser
7b17cc404a Oracle test suite up to date 2015-04-27 20:22:05 -04:00
Tim Griesser
36ced91ed5 Testing transactions, beginning to use tape, adding query to error message 2015-04-24 10:10:34 -04:00
Tim Griesser
918f6056d1 Nested transactions, needs explicit tests 2015-04-23 16:04:48 -04:00
Tim Griesser
e570c167c1 JSHint and formatting 2015-04-22 15:39:29 -04:00
Tim Griesser
f9aab9dc76 Major internal refactor
Beefed up transaction implementation, still needs tests
and cleanup of nested transaction queues.

Left todo:
- Fix commented out tests
- Fix oracle driver's transactions
2015-04-22 10:34:14 -04:00
Tim Griesser
27cd9f12c5 Cleanup pool implementation, preparing things for new release 2015-04-17 15:00:08 -04:00
Vincent Schoettke
98f4f9a1dd Removed jshint expr and fixed warnings 2014-09-02 22:03:14 +02:00
Vincent Schoettke
f3874ac651 Fixed several jshint warnings. Added strict mode 2014-09-01 17:19:34 +02:00
Vincent Schoettke
f545c86081 oracle - fixed first and added more tests 2014-08-22 01:13:15 +02:00
Vincent Schoettke
9ef99b5f92 Added oracle support 2014-08-13 21:53:42 +02:00