2646 Commits

Author SHA1 Message Date
Mikael Lepistö
ae1245ebcb
Fix mssql driver crashing (#2637)
* Run SQL Server tests locally running SQL server in docker

* WIP mssql test stuff

* Patched MSSQL driver to not crash knex anymore
2018-06-10 23:56:08 +03:00
Daniel Ruf
1a6aa56e14 chore: add Node.js 10 (#2594)
* chore: add Node.js 10

* chore: trigger new build

* chore: update lockfile

* chore: trigger new build

* fix: use npm i instead of npm ci
2018-06-10 12:36:33 +03:00
Simon Lidén
27250b6f45 Timeout errors shouldn't silently ignore the passed errors, but rather reject with original error. Fixes #2582 (#2626) 2018-06-06 00:05:00 +03:00
Sami Koskimäki
1c65e69bc0 fixes 2630 (#2642) 2018-06-05 15:31:09 +03:00
Igor Savin
d9cd54b2ac Remove readable-stream and safe-buffer (#2640)
* Add json support to the query builder for mysql

refs #1036

Based on #1902

* Clarify supported version

* Use native Buffer and Stream implementations
2018-06-01 14:34:27 +03:00
Tim
3e95405037 fix wrapIdentifier not being called in postgres alter column (#2612)
* fix wrapIdentifier not being called in postgres alter column

* add test for wrapIdentifier call in postgres alter column

* add comment regarding issue

* add issue & PR #'s in comment
2018-05-30 17:57:51 +03:00
Igor Savin
4d4e4ca1e7 Add json support to the query builder for mysql (#2635)
* Add json support to the query builder for mysql

refs #1036

Based on #1902

* Clarify supported version
2018-05-30 17:26:03 +03:00
Tim Griesser
5f8584cedf
Remove babel-plugin-lodash (#2634)
While in theory, this may reduce the bundle size,
in practice it adds a ton of overhead during startup
due to the number of additional requires. Bundle
size also shouldn't matter for server side modules.
2018-05-29 14:54:32 -04:00
Simon Lidén
05e9150346 Drop support for strong-oracle (#2487) 2018-05-29 13:31:40 -04:00
Michael Storgaard
51ee9bba17 Fixed onIn with empty values array (#2513) 2018-05-29 12:35:37 -04:00
Simon Lidén
65509c38ef Allow overwriting log functions (#2625)
* Example build of custom log functions
* Handle logger object better for transactions
* Adjust test to ignore sqlite warning message
2018-05-29 11:42:03 -04:00
Simon Lidén
cf51f5c429 Removal of 'skim' (#2520) 2018-05-29 10:14:35 -04:00
Will
7a60e310c8 Add support for native enums on Postgres (#2632)
Reference https://www.postgresql.org/docs/current/static/sql-createtype.html

Closes #394

Signed-off-by: Will Soto <will.soto9@gmail.com>
2018-05-29 10:09:13 -04:00
Michael Oliver
db390b11e6 Increment floats (#2614)
* Fix increment/decrement with float values

* parse float in mariadb

* mysql produces float(8, 2), not double
2018-05-19 11:49:00 +03:00
Andy Stanberry
51e44052b4 Support postgresql connection uri protocol (#2609) 2018-05-18 12:12:15 +03:00
Daniel Ruf
e3beaf20d6 chore: cache node_modules (#2595)
* chore: use yarn cache

* chore: trigger new build to test yarn cache

* chore: cache node_modules

* chore: trigger new build

* chore: trigger new build

* style: reformat
2018-05-14 10:03:54 +03:00
devin ivy
3bed888145 Ensure knex.destroy() returns a bluebird promise (#2589) 2018-05-03 18:45:08 +03:00
Igor Savin
4a6d2873f8 stop executing tests on Node 4 and 5, update documentation. (#2451)
* general: stop executing tests on Node 4 and 5, update documentation.

* adds engines to package.json

* Update .travis.yml

* fix package.json

* Don't run tests on Node 10 yet

No prebuilt Oracle driver for Node 10 yet: https://github.com/oracle/node-oracledb/issues/901
2018-05-03 18:44:51 +03:00
Mikael Lepistö
88e4bc5f91
Updated mssql support contributor's github name 2018-05-02 13:51:16 +03:00
Simon Lidén
e724066fcb Added 'ref' function (#2509)
* Added 'ref' function

* Fixed Ref export

* Added .as() for aliasing references
2018-05-02 13:31:16 +03:00
Jiri Spac
e086427db0 fixes #2500 (#2505) 2018-04-26 00:11:24 +03:00
k00p
2159f8fc40 Primary Key for Migration Lock Table (#2569)
* Update index.js

* Update index.js
2018-04-25 20:56:28 +03:00
Ricardo Graça
14ac2cbaa7 Create timestamp columns with millisecond precision on MySQL 5.6 and newer (#2542)
* Add test for precise timestamps schema building

* Create precise timestamp columns on MySQL 5.6+

* Increase precision of timestamps to microsecond

- Six is the maximum that it supports and there's no reason not to use
the maximum available precision.

* Add warning when version is not specified in MySQL

* Update warning message when missing mysql version
2018-04-18 23:14:29 +03:00
Simon Lidén
77127012f8 0.14.6 0.14.6 2018-04-12 10:00:44 +02:00
Simon Lidén
8488e22abe
Bugfix/query event sql string (#2566)
* Restore 'query' event to its original form (no native sql string). Fixes #2549

* Fix assertions in test
2018-04-12 09:17:45 +02:00
Mikael Lepistö
c89119b681 Fixed running tape tests when DB variable not set 0.14.5 2018-04-08 22:27:33 +03:00
Mikael Lepistö
bde621cbf5 Updated changelog and bumped version for npm 2018-04-08 21:59:07 +03:00
Igor Savin
9db6c5e638 Update dependencies (#2561) 2018-04-08 20:49:14 +03:00
Adam Cofer
ee8cc35ecb Fix #2545, bring redshift wrapIdentifier custom hook up to date with postgres (#2551)
* 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

* Sublime Text gitignore

* Redshift does not support adding more than one column in alter table

* Fix integration tests for redshift

* Linter

* Combine dialect test skip if clause
2018-04-05 01:43:39 +03:00
Igor Savin
843a16799d Support DB schema for migrations - fixes #2499 (#2559)
* WIP

* implement schema support for migrations

* Refactor

* Cleanup

* Restore unneeded changes

* Restore more removed code

* Restore newline

* Execute all tests

* Fix linting error

* Add schema creation

* Drop tables before dropping schema

* Cascade drop for schema
2018-04-05 01:19:08 +03:00
Randy Garces
a85b3a4fa0 GH-2550 Add support to wrap returning column (#2554)
* GH-2550 Add support to wrap returning column

- utilize `this.formatter.wrap` for every columnName in returningClause

* #2550  Add unit test

* Fix unit test
2018-04-05 00:36:38 +03:00
Julien Bouquillon
0a1976d8fd add clearOrder method fix #2360 (#2553) 2018-04-02 17:28:01 +03:00
Joel Mukuthu
fbef9fcec7 feat: countDistinct with multiple columns (#2449)
* test(QueryBuilder): add test for countDistinct with multiple columns

* test: add integration test for countDistinct with multiple columns

* feat(QueryBuilder): support multiple columns for countDistinct

* feat(QueryBuilder): support object alias notation for aggregate methods

i.e. `count`, `countDistinct`, `max`, `min`, `avg`, `avgDistinct`, `sum`, `sumDistinct`

* test: fix integration tests for countDistinct

* fix(QueryBuilder): fix countDistinct formatting with multiple columns

* refactor(QueryBuilder): add _aggregate from helpers

* fix(QueryCompiler): only use parens for distinct with postgres

* test(QueryBuilder): remove unsupported tests

for count with multiple distinct columns in databases where this is
not supported

* refactor(QueryBuilder): improve readability
2018-03-12 23:42:43 +02:00
Simon Lidén
ad1062b905
Added error if chaining update/insert/etc with first() (#2506) 2018-02-22 12:33:55 +01:00
Rhys van der Waerden
965542d3ef Support multi-column whereIn with query (#1390)
* Support multi-column `whereIn` with query

Add support for supplying a subquery for a `whereIn` statment on multiple columns.

Fixes #1384.

* Fixed method

* Removed duplicate import

* Fixed isArray calls and linter warnings

* Fixed isArray call

* Fixed tests and added assertions for all dialects
2018-02-21 22:51:09 +02: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
Simon Lidén
07485dba57 Fix "maxLength is not defined" error in sqlite3 query compiler 2018-02-21 10:37:33 +01:00
Mikael Lepistö
ce0946e74b
Runnin mssql tests in docker (#2496)
* Run SQL Server tests locally running SQL server in docker

* Made oracledb test script naming consistent with mssql

* Updated documentation with more info about oracledb and mssql testing
2018-02-20 11:51:51 +02: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
Mikael Lepistö
ece2da12ca
Added npm run test:oracledb command that runs oracledb tests in docker (#2491)
Also cleaned up some old docker configurations from test knexfile
2018-02-20 10:47:05 +02:00
Mikael Lepistö
aa78edc5bc Updated changelog and bumped version for 0.14.4 0.14.4 2018-02-19 19:24:37 +02:00
Simon Lidén
ec75f02432
Added test for Event 'start' (#2488)
* Added test for Event 'start'

* Typecast to string
2018-02-19 10:13:10 +01:00
Simon Lidén
a0abdd030b
Changed babel preset and use latest node as target when running dev (#2484) 2018-02-19 09:22:38 +01:00
Mikael Lepistö
6d52ee7b72
Removed obsolete comment 2018-02-19 09:47:10 +02:00
Simon Lidén
2ed490c07b
Changed rm to rimraf in 'npm run dev' (#2483) 2018-02-18 13:19:59 +01:00
Simon Lidén
3bec266b10
Removed unused property __cid on the base client (#2481) 2018-02-17 12:15:29 +01:00
Simon Lidén
074ceaeadd
Allow calling lock procedures (such as forUpdate) outside of transaction. Fixes #2403. (#2475) 2018-02-16 14:06:49 +01:00
Mikael Lepistö
d4a85db410
Removed old docker tests, new stress test setup tests are testing the same stuff (#2474)
Currently stress tests are run locally manually, but CI could be set up to run them for a few minutes and record request counts and memory usage during tests.
2018-02-16 13:13:04 +02:00
Mikael Lepistö
7ff766f7a3
Removed unnecessary createTableIfNotExist and replaced with createTable (#2473)
It is already tested in upper level that table wasn't there if this method is called.
2018-02-16 12:38:16 +02:00
Mikael Lepistö
e250260235
Added stress test, which uses TCP proxy to simulate flaky connections (#2460)
* Added stress test, which uses TCP proxy to simulate flaky connections

* Added test code for mysql and mariadb drivers

* Dropped trying to figure out support for mariasql driver

* Bunch of tests to make knex fail if connections are breaking randomly

* Added marker to printout logs before app crash

* Fixed mysql acquire connection and destroy conneciton code

Acquire connection did bind error handler too late and didn't free it on success. Destroy did free event listeners before connection end was called, so error during connection end leaked out.
2018-02-16 11:25:23 +02:00