2646 Commits

Author SHA1 Message Date
Igor Savin
8c87650388 Support passing connection override to a query (#2817)
* Support passing connection override to a query

* Include connection param when cloning

* Only clone connection override if specified
2018-09-27 01:08:18 +03:00
Mikael Lepistö
aadfdb2aa0 Updated changelog and package version for @next release 2018-09-27 00:57:13 +03:00
Igor Savin
1f8567393c Fix ES6 support (#2821)
* Add polyfills for Node 6
2018-09-27 00:41:00 +03:00
veikovx
932fa4b683 Kill queries after timeout for PostgreSQL (#2636)
* Kill queries after timeout for PostgreSQL

* Fix cancellation connection acquiring and test.

* Fix releasing connection in case query cancellation fails

* 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>

* Removal of 'skim' (#2520)

* Allow overwriting log functions (#2625)

* Example build of custom log functions
* Handle logger object better for transactions
* Adjust test to ignore sqlite warning message

* Fixed onIn with empty values array (#2513)

* Drop support for strong-oracle (#2487)

* 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.

* 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

* 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

* 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

* fixes 2630 (#2642)

* Timeout errors shouldn't silently ignore the passed errors, but rather reject with original error. Fixes #2582 (#2626)

* 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

* 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

* Removed semicolon from rollback stmt for oracle (#2564)

* Remove WebSQL dialect (#2647)

* Add json support to the query builder for mysql

refs #1036

Based on #1902

* Clarify supported version

* Use native Buffer and Stream implementations

* Remove WebSQL dialect

* add homepage field to package.json (#2650)

* Make the stream catch errors in the query (#2638)

* Make the stream catch errors in the query

* Fix another case in which stream doesnt emits error

* Linter stuff

* Remove setTimeout in tests

* Make a test not to check the MySQL error code

* Fix stream error catching for MariaDB and PostgreSQL

* Fix stream error catching in Oracle

* Throw the error after emitting it to the stream

* Throw the error without instantiating a new Error

* 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

* Updated changelog and version

* Drop mariadb support  (#2681)

* Dropped support for mariasql

* ESLint

* Fixed docs to build again

* Fix knex.initialize() and adds test (#2477)

* Fix knex.initialize() and adds test

* Fix knex.initialize() and adds test

* Added test for reinitializing pool after destroy

* Fixed destroy / reinitialization test

* Fixed the fix

* Implement missing schema support for mssql dialect

* chore: Update dependencies. Remove estraverse (#2691)

* Update dependencies. Remove estraverse

* Fix compatibility with new Sinon

* Increase mssql timeout

* 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

* Add Prettier (#2697)

* Add prettier
* Run files through prettier

* Istanbul -> NYC (#2700)

* istanbul -> nyc

* Update mocha

* Enforce code coverage (#2702)

* Enforce code coverage
* Update coverage numbers with current values

* version assignment on base class, copy on tx client, fix #2705

* Update changelog

* v0.15.1

* Added build step to test script. Fixes #2541 (#2712)

* Revert "Added build step to test script. Fixes #2541 (#2712)" (#2714)

This reverts commit 90ed8db58053b859a6bdc45a17f2f510ce8a3411.

* Allow oracle failures for now

* Fix issue with select(0) (#2711)

* Fix issue with select(0). Fixes #2658

* Refactor migrator (#2695)

* Refactor migrator

* Fix exports

* Fix ESLint

* Fix migrator

* Fix reference to config

* Split some more

* Fix table builder

* Fix argument order

* Merge branch 'master' of https://github.com/tgriesser/knex into feature/2690-support-multiple-migration-dirs

# Conflicts:
#	src/migrate/index.js
#	test/index.js
#	test/unit/migrate/migrator.js

* Fix #2715 (#2721)

* Fix #2715, explicitly set precision in datetime & timestamp
* Allow for precision in knex.fn.now, mysql time
* Add test for datetime with precision

* Bump changelog

* 0.15.2

* Fix issues with warnPromise when migration does not return a promise. Fixes #2725 (#2730)

* Add tests for multiple union arguments with callbacks and builders (#2749)

* Add tests for multiple union arguments

* Add some callback and raw tests to union unit tests

* Compile with before update so that bindings are put in correct order (#2733)

* Fix join using builder withSchema. (#2744)

* Use Datetime2 for MSSQL datetime + timestamp types (#2757)

* Use Datetime2 for MSSQL datetime + timestamp types

Datetime2 is now the recommended column type for new date work: https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime-transact-sql?view=sql-server-2017

* Add tests for MSSQL datetime2 changes

* General/document breaking change (#2774)

* Add changelog entry for a breaking change

* Improve entry

* Allow timestamp with timezone on mssql databases (#2724)

* Allow timestamp with timezone on mssql databases

* Change timestamp parameter to use object instead of boolean

* Update dependencies (#2772)

* Feature/2690: Multiple migration directories (#2735)

* Implement support for multiple migration directories

* Add tests for new functionality

* Fix tape tests

* Pass migration directory upwards

* Fix multiple directory support

* Fix bugs

* Rollback correctly

* Fix remaining tests

* Address comments

* #2758: Implement fail-fast logic for dialect resolution (#2776)

* Implement fail-fast logic for dialect resolution, clean-up code around.

* Remove method that was deprecated long time ago

* Address additional comments

* Try addressing comments

* Set client explicitly

* Fix compatibility with older Node versions

* Use columnize instead of wrap in using(). (#2713)

* Use columnize instead of wrap in using().

This is an attempt to fix #2136. Also added an integration test, couldn't find any existing.

* Exclude MSSQL from test as it does not support .using

* Change test to not use subquery

* Change test

* Introduced abstraction for getting migrations (#2775)

* Introduced abstraction for getting migrations

This would allow a webpack migration source which is compatible with bundling.

* Fixed migration validation with custom migration source

* Fixed issues after rebasing on muti directory PR

* Renamed parameter and fixed error message

* Addressed some PR comments

* Finished comment

* Moved filename extension filtering into fs-migrator

* Added test showing in memory custom migration source

* Cleaned up how to get config

* Fixed failing test

* Hopefully fix tests

* Fix Node.js 10 support in tests

* Test for correctly releasing cancel query connection
2018-09-27 00:06:43 +03:00
Igor Savin
d4a3387c56 Pass migration config object as an argument to the migrations (V 2.0) (#2802)
* Pass migration config object as an argument to the migrations themselves, to allow custom parameters to be set for migrations. (#2014)

* Run prettier

* Remove unneeded change

* Remove more unneeded changes

* Fix Node 10 support

* Update documentation based on a new design

* Restore test execution (oops)

* Fix withUserParams method

* Fix knex instance cloning

* Remove unused import

* Fix reference to knex from migrator

* Do not lose user params on transactions

* Remove unneeded require

* Address review comments

* Fix setting event emitter and listeners on Knex copies. Use knex copies to run tests in CI

* Remove knex cloning

* Fix event listener leak
2018-09-26 23:27:59 +03:00
Igor Savin
093f7227b5 Use Babel 7 (#2813)
* WIP changes

* Use Babel 7

* Fix build

* Fix Node 6 compatibility (apparently Babel has no idea how to transform Object.values)

* Try ignoring "expected behaviour" error (https://github.com/babel/babel-loader/issues/152)

* Coverage dropped since less code gets generated now, time to revisit threshold
2018-09-26 23:11:30 +03:00
Igor Savin
776a115c73 Add json type support for SQLite (#2814)
* Add json type support for SQLite 3.9+ (which is node-sqlite 4.0.0+, I think)

* Remove unneeded import
2018-09-26 09:15:31 +03:00
Mikael Lepistö
8e0ce7a450
Updated styling of markdown. 2018-09-19 01:25:58 +03:00
Mikael Lepistö
291fa4d130 Updated changelog / package.json for @next release 2018-09-19 01:16:07 +03:00
Jake Ginnivan
d0e3be422c Extract MigrationGenerator from Migrator (#2786) 2018-09-18 01:04:10 +03:00
Igor Savin
f01d5fae39 Update dev dependencies to hopefully make coverage calculation more deterministic (#2810) 2018-09-17 16:02:53 +03:00
Jake Ginnivan
bf1e384ed6 Introduced abstraction for getting migrations (#2775)
* Introduced abstraction for getting migrations

This would allow a webpack migration source which is compatible with bundling.

* Fixed migration validation with custom migration source

* Fixed issues after rebasing on muti directory PR

* Renamed parameter and fixed error message

* Addressed some PR comments

* Finished comment

* Moved filename extension filtering into fs-migrator

* Added test showing in memory custom migration source

* Cleaned up how to get config

* Fixed failing test

* Hopefully fix tests

* Fix Node.js 10 support in tests
2018-09-12 14:58:37 +03:00
Simon Lidén
1616b2af0d Use columnize instead of wrap in using(). (#2713)
* Use columnize instead of wrap in using().

This is an attempt to fix #2136. Also added an integration test, couldn't find any existing.

* Exclude MSSQL from test as it does not support .using

* Change test to not use subquery

* Change test
2018-08-29 20:43:45 +03:00
Igor Savin
89d2b3a5e1 #2758: Implement fail-fast logic for dialect resolution (#2776)
* Implement fail-fast logic for dialect resolution, clean-up code around.

* Remove method that was deprecated long time ago

* Address additional comments

* Try addressing comments

* Set client explicitly

* Fix compatibility with older Node versions
2018-08-29 18:13:16 +03:00
Igor Savin
91f23bc02f Feature/2690: Multiple migration directories (#2735)
* Implement support for multiple migration directories

* Add tests for new functionality

* Fix tape tests

* Pass migration directory upwards

* Fix multiple directory support

* Fix bugs

* Rollback correctly

* Fix remaining tests

* Address comments
2018-08-24 12:39:20 +03:00
Igor Savin
8ff0a5ec41 Update dependencies (#2772) 2018-08-23 14:27:16 +03:00
Caíque de Castro Soares da Silva
337455f63a Allow timestamp with timezone on mssql databases (#2724)
* Allow timestamp with timezone on mssql databases

* Change timestamp parameter to use object instead of boolean
2018-08-23 13:10:19 +03:00
Igor Savin
220047f43b General/document breaking change (#2774)
* Add changelog entry for a breaking change

* Improve entry
2018-08-20 10:22:06 +03:00
Will Morgan
fac313f27f Use Datetime2 for MSSQL datetime + timestamp types (#2757)
* Use Datetime2 for MSSQL datetime + timestamp types

Datetime2 is now the recommended column type for new date work: https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime-transact-sql?view=sql-server-2017

* Add tests for MSSQL datetime2 changes
2018-08-13 15:33:37 -05:00
Simon Lidén
2183a27826 Fix join using builder withSchema. (#2744) 2018-08-04 18:50:50 +03:00
Simon Lidén
30bab697ba Compile with before update so that bindings are put in correct order (#2733) 2018-08-04 18:33:10 +03:00
Scott Trinh
bf1a2dcb93 Add tests for multiple union arguments with callbacks and builders (#2749)
* Add tests for multiple union arguments

* Add some callback and raw tests to union unit tests
2018-08-03 21:11:38 +02:00
Simon Lidén
26dfeb8805
Fix issues with warnPromise when migration does not return a promise. Fixes #2725 (#2730) 2018-07-25 08:20:33 +02:00
Tim Griesser
f55140f4f6 0.15.2 0.15.2 2018-07-19 11:08:14 -04:00
Tim Griesser
064b4aff53 Bump changelog 2018-07-19 11:04:28 -04:00
Tim Griesser
4fd16da45a
Fix #2715 (#2721)
* Fix #2715, explicitly set precision in datetime & timestamp
* Allow for precision in knex.fn.now, mysql time
* Add test for datetime with precision
2018-07-19 10:46:23 -04:00
Igor Savin
a01c35941a Refactor migrator (#2695)
* Refactor migrator

* Fix exports

* Fix ESLint

* Fix migrator

* Fix reference to config

* Split some more

* Fix table builder

* Fix argument order

* Merge branch 'master' of https://github.com/tgriesser/knex into feature/2690-support-multiple-migration-dirs

# Conflicts:
#	src/migrate/index.js
#	test/index.js
#	test/unit/migrate/migrator.js
2018-07-17 10:41:44 +03:00
Simon Lidén
0f4c9bdef9 Fix issue with select(0) (#2711)
* Fix issue with select(0). Fixes #2658
2018-07-13 09:31:53 -04:00
Tim Griesser
6f11eb16b3 Allow oracle failures for now 2018-07-13 09:26:46 -04:00
Simon Lidén
d508609d43
Revert "Added build step to test script. Fixes #2541 (#2712)" (#2714)
This reverts commit 90ed8db58053b859a6bdc45a17f2f510ce8a3411.
2018-07-13 14:15:03 +02:00
Simon Lidén
90ed8db580
Added build step to test script. Fixes #2541 (#2712) 2018-07-13 13:23:32 +02:00
Tim Griesser
5eb0c2f293 v0.15.1 v0.15.1 2018-07-12 23:21:53 -04:00
Tim Griesser
675ed87587 Update changelog 2018-07-12 23:11:46 -04:00
Tim Griesser
b20a7ad45d version assignment on base class, copy on tx client, fix #2705 2018-07-11 13:31:36 -04:00
Fabian Kantereit
e08c14b7b1 Implement missing schema support for mssql dialect 2018-07-10 12:55:12 -04:00
Igor Savin
0db2a1eaae Update mocha 2018-07-09 17:50:28 -04:00
Igor Savin
046b156b76 Enforce code coverage (#2702)
* Enforce code coverage
* Update coverage numbers with current values
2018-07-09 17:50:06 -04:00
Tim Griesser
6cb02e0961
Istanbul -> NYC (#2700)
* istanbul -> nyc
2018-07-09 15:58:22 -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
Igor Savin
3282d6a890 chore: Update dependencies. Remove estraverse (#2691)
* Update dependencies. Remove estraverse

* Fix compatibility with new Sinon

* Increase mssql timeout
2018-07-07 10:47:51 +03:00
Pablo M
a41316bb34 Fix knex.initialize() and adds test (#2477)
* Fix knex.initialize() and adds test

* Fix knex.initialize() and adds test

* Added test for reinitializing pool after destroy

* Fixed destroy / reinitialization test

* Fixed the fix
2018-07-02 23:52:32 +03:00
Mikael Lepistö
1e0567f92b Fixed docs to build again 2018-07-02 18:18:33 +03:00
Mikael Lepistö
2a2cad34d9 Updated changelog and version 0.15.0 2018-07-01 23:09:16 +03:00
Mikael Lepistö
e2f617b968
Drop mariadb support (#2681)
* Dropped support for mariasql

* ESLint
2018-07-01 23:06:26 +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
Facundo Matteo
ec8550249f Make the stream catch errors in the query (#2638)
* Make the stream catch errors in the query

* Fix another case in which stream doesnt emits error

* Linter stuff

* Remove setTimeout in tests

* Make a test not to check the MySQL error code

* Fix stream error catching for MariaDB and PostgreSQL

* Fix stream error catching in Oracle

* Throw the error after emitting it to the stream

* Throw the error without instantiating a new Error
2018-06-27 22:42:50 +03:00
jaawerth
933d570ce7 add homepage field to package.json (#2650) 2018-06-22 20:33:22 +03:00
Igor Savin
d76cbffa56 Remove WebSQL dialect (#2647)
* Add json support to the query builder for mysql

refs #1036

Based on #1902

* Clarify supported version

* Use native Buffer and Stream implementations

* Remove WebSQL dialect
2018-06-18 22:36:02 +03:00
Cemre Mengu
0a0ce35cbf Removed semicolon from rollback stmt for oracle (#2564) 2018-06-18 22:25:40 +03:00