893 Commits

Author SHA1 Message Date
Zach McElrath
b626702b47
Add migrate:unlock command, truncate on forceFreeMigrationsLock (#3822) 2020-04-23 21:51:32 +02:00
Igor Savin
e37aeaa31c
Prepare for 0.21.0 release (#3811) 2020-04-19 00:40:23 +02:00
tkalliom
02d94d96b0
Reduce size of lodash in bundle (#3804) 2020-04-18 19:41:23 +02:00
Brian Lauber
8d5715a03a
Fix: Support for .finally(..) on knex's Promise-alikes (#3800) 2020-04-15 21:05:40 +02:00
Edvaldo Szymonek
336b41e148
Add clearGroup method (#3771) 2020-04-13 01:09:51 +02:00
Kabir Baidhya
a6551559f0
Minor improvements on the usage of fs utilities - unify all the fs functions into the same util/fs to simplify things (#3749) 2020-03-24 15:50:47 +01:00
Igor Savin
e552fbda78
Make protocol length check more defensive (#3744) 2020-03-22 23:51:42 +01:00
Kabir Baidhya
078b749892
Add unit tests for escape utility functions (#3742) 2020-03-22 18:44:51 +01:00
Kabir Baidhya
a7031c3cef
Upgrade package mkdirp and improve it's usage (#3741) 2020-03-21 11:01:10 +01:00
Florent Vilmart
998c92ca97
Typescript: Makes the ChainableInterface conform to Promise<T> (#3724) 2020-03-19 23:19:57 +01:00
Brian Lauber
31c5b86ec4
Fix: Transaction_OracleDB can use config.connection (#3731) 2020-03-15 20:30:40 +01:00
Brian Lauber
37d9c30347
Fix/method binding on knex proxy (#3717)
* knex methods are proxies for context methods ...

... as opposed to injecting the methods directly onto the knex
function.  (Which was then causing `this` to point to the wrong
object when evaluating the context methods)

* Moved CONTEXT_METHODS constant to a higher scope

* mv knex.context -> this.context

* Extracted KNEX_PROPERTY_DEFINITIONS to module scope ...

... which was possible since all of the properties reference
`this` instead of `knex` now

* shallowCloneFunction no longer accesses _context ...

... instead, it uses the normal context property

* transaction method delegates to _transaction ...

... This way, we can be sure that the lower-level details are
consistent across implementations.  Individual implementations
just need to handle the quirks around setting up the `config`
and `outerTx`

* CONTEXT_METHODS shared. Fixed override of withUserParams ...

Restructured the code so that CONTEXT_METHODS populates the
KNEX_PROPERTY_DEFINITIONS with the proxy methods.

In doing so, it also exposed the fact that the withUserParams(..)
method was being overridden on the Transactor instead of its
context.  So, that bug was fixed as well.

* Added a TODO to remove client.makeKnex(..) in future PR

* Added a warning about QueryBuilder.extend(..) and side-effects
2020-03-11 16:05:03 -04:00
Brian Lauber
c309c98f04
Cleanup/remove transaction stalling (#3716)
* Transactions initialize their own _lastChild placeholder ...

... rather than initializing the _lastChild on their outerTx

* Transaction initialization logic no longer needs to be stalled

* Extracted _previousSibling logic out of _evaluateContainer
2020-03-10 09:52:11 -04:00
Brian Lauber
d00bd8d2dd
Fix: Added missing call to _reject in Transactor#transaction (#3706) 2020-03-07 01:53:33 +01:00
Brian Lauber
6e6b666603
Rewrote Transaction#acquireConnection() methods to use async (#3707) 2020-03-07 01:15:23 +01:00
Igor Savin
85888ce3c2
Prepare to release 0.20.11 (#3689) 2020-03-05 21:43:57 +01:00
Igor Savin
b80966a60e
Cleanup/extract transaction ordering logic (implementation 2.0) (#3698) 2020-03-05 21:40:33 +01:00
Igor Savin
46783590be
timeout(..) function clears unnecessary timeouts (#3703) 2020-03-05 21:37:23 +01:00
Brian Lauber
51052c52e8
Cleanup/remove dead oracle code (#3697) 2020-03-03 00:18:45 +01:00
maximelkin
dc30abf39e
bugfix mysql query errors ignored (#3690) 2020-02-29 00:16:07 +01:00
maximelkin
b025aea318
remove dependency on bluebird methods from sources (#3683)
Co-authored-by: Brian Lauber <constructible.truth@gmail.com>
2020-02-25 22:50:24 +01:00
lando-cal
3bea3f66ec
Add OracleDB handling for buffer type in fetchAsString (#3685)
As released in [2.3.0](https://github.com/oracle/node-oracledb/blob/master/CHANGELOG.md#node-oracledb-v230-7-jun-2018) of node-oracledb, this adds handling to fetchAsString for the `BUFFER` type, allowing fetchAsString to interpret `RAW` fields.
2020-02-25 01:27:33 +01:00
Brian Lauber
f3151bdc93
Cleanup and extract Transaction Workflow logic (rebase) (#3674) 2020-02-20 20:44:18 +01:00
Brian Lauber
eaf0d15b18
Fix race condition in non-container transactions (#3671)
* Transaction logic establishes 2 separate Promise Chains...

... One chain is for INTERNAL use within the Transaction logic
itself.  This chain ignores exceptions.  It is simply used to
signal when the "Next Transaction" (sibling) is allowed to begin.

The other chain is for EXTERNAL use.  It expects the caller
to handle any exceptions that occur during the Transaction.
2020-02-19 23:40:03 +01:00
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
Brian Lauber
31e5418eb1
Fixed unresolved promise in cancelQuery(..) ... (#3666)
cancelQuery(..) was attempting to
"cancel the cancellation" after 100ms.  However, it was not
actually achieving this objective.  In reality, the cancellation
was still running in the background even though the caller had
already moved on.

Later on, the cancellation would ACTUALLY fail due to a resource
allocation issue (ie: no more connections in the Tarn pool).
This would then result in an unhandled Promise rejection.
2020-02-16 20:05:50 +01:00
maximelkin
88d832cd36
replace Bluebird.timeout (#3634) 2020-02-12 21:42:15 +01:00
Lorefnon
589ea747c2
Update QueryCompiler implementation to use classes (#3647) 2020-02-01 17:22:00 +01:00
Igor Savin
c14252d907
Refactor more tests to use cli-testlab (#3640) 2020-01-28 02:28:40 +01:00
Jake Coffman
22558209d4 dispose Oracle connection on connection error (#3611)
Co-authored-by: abskmj <abskmj@gmail.com>
2020-01-05 18:47:32 +01:00
Igor Savin
80a2516734
Throw better error when trying to modify schema while using unsupported dialect (#3609) 2020-01-05 00:04:41 +01:00
Kabir Baidhya
2800e72d2f Add tests for some of the string utility functions (#3568) 2020-01-04 22:59:41 +01:00
Jake Coffman
07997279b7 fix #3605 not releasing connection from pool on disconnect (#3606) 2020-01-04 22:56:14 +01:00
Igor Savin
4feefdf3d2 Enforce Unix (lf) line terminators (#3598) 2019-12-29 20:28:40 +01:00
Lorefnon
3914bf52af Fix colors in debug logs (#3592) 2019-12-28 23:59:57 +01:00
Igor Savin
9b37c9480b
Return more information about empty updates (#3597) 2019-12-28 22:36:14 +01:00
Thomas Sondergaard
c277edbaf1 Use more efficient algorithm for generating internal ids (#3595) (#3596) 2019-12-27 20:16:38 +01:00
Ahmed Ashour
a613fe23df Fix some spelling mistakes (#3572) 2019-12-10 22:53:05 +01:00
Ahmed Ashour
d5773f8a44 Use Buffer.alloc() instead of deprecated () (#3574) 2019-12-10 22:51:57 +01:00
Lorefnon
c53247d6ee Make logger methods mutually consistent (#3567)
Resolves #3363
2019-12-07 23:57:20 +01:00
Lorefnon
65e1a3a3d0 Fix debug logger messing up queries with % (#3566) 2019-12-07 22:15:39 +01:00
maximelkin
84fce33f69 Remove bluebird.using (#3552) 2019-11-28 20:44:18 +01:00
Igor Savin
1ca7bc2f2b
Clarify acquireConnection() signature (#3554) 2019-11-28 00:01:29 +01:00
MaliaGuerrero
03d6f063d5 Initialize data to buffer instead of string for non-strings (#3545) 2019-11-21 19:46:45 +01:00
JbRezidu
2ac08c396a fix(timeout): knex timeout for postgresql use cancel instead of terminate (#3518) 2019-11-21 15:23:24 +01:00
Lorefnon
79ccb7d8bd Lift up dialect specific methods in the CreateTableBuilder (#3532) 2019-11-21 15:22:29 +01:00
Andrei
07276bcbbb Add connection string qs to connection params (#3547) 2019-11-21 15:21:51 +01:00
Alexandre BODIN
0214f11663 Make sqlite3 hasColumn case insensitive (#3435) 2019-11-14 19:31:59 +01:00
Lorefnon
f87b28c3e3 Add support for distinct on for postgres (#3513)
Resolves #3472
2019-11-11 00:51:47 +01:00
Edvard Chen
0560959fa4 feat: wrap subQuery with parenthesis when it appears as table name (#3496) 2019-10-28 21:38:01 +01:00