2646 Commits

Author SHA1 Message Date
Dave Wasmer
f8989e129f Fix debug output typo (#2187)
Transactions store their unique id on the `txid` property, not `id`.
2017-08-16 09:42:02 +03:00
Kurre Ståhlberg
03f0fb426c Remove sorting of statements from UPDATE (#2169) (#2171) 2017-07-26 11:36:50 +03:00
wubzz
98025fae55 searchPath should be case-sensitive (#2172)
Previously `{searchPath: 'TEST'}` would result in `test` rather than `TEST`.
2017-07-25 15:13:07 +02:00
Richard Ižip
822f3d3dd0 Fix drop of multiple columns in sqlite3 (#2107)
* Bugfix for issue #1979
* The problem was that dropColumn method in sqlite3
  Compiler was using only first argument it got from
  apply
* Reworked to use 'arguments' instead
2017-07-25 12:42:59 +03:00
doomsower
1c61ad898f Allows to filter seeds and migrations by extensions (#2168)
* Added `loadExtensions` parameter to filter which migrations and seeds will be executed

* `loadExtensions` now includes all supported extensions by default
Also added unit tests for modified code
2017-07-24 14:19:17 +03:00
Mikael Lepistö
c7dfcb6292 Fixing docker CI tests (#2164)
* Fixing docker CI tests

* Removed support for node 0.12 and added node 8 to CI

* Trying to fix babel issue happening on node 8

* Could not reproduce the problem on local install... disabling node 8 travis tests for now.
2017-07-23 16:33:25 +03:00
Richard Ižip
298a5854ec Add unit test for right/rightOuterJoin combination (#2117)
* Do not include test for sqlite3 because it
  currently does not support right join
2017-06-26 20:16:37 +03:00
Richard Ižip
d10b0d00b2 Add fullOuterJoin unit test (#2118)
* No fullOuterJoin for MySQL and sqlite3
  because they do not support it
2017-06-26 20:01:33 +03:00
Richard Ižip
16a4eb1455 Fix adding more columns in Oracle (#2115)
* Fix incorrent unit tests to reflect
  current changes
2017-06-10 21:01:57 +03:00
Richard Ižip
e63fe22555 Add unit tests for table comment (#2098)
* Tests for setting comment on table for postgresql, mysql and oracle

* No tests for sqlite as it does not seem to support comments

* No tests for mssql as it can not be tested simply using sql comparison
2017-06-10 20:47:51 +03:00
irsl
5fc456cb69 integration test for sqlite3, referencing non-existent column in the query (#2104)
* integration test for sqlite3, referencing non-existent column in the query

* making node 0.12 happy
2017-06-10 01:20:59 +03:00
Dave Grochowski
c18374e269 Use the schema when dropping indices in Postgres. (#2105) 2017-06-10 01:07:57 +03:00
Richard Ižip
e88490342e Add unit test for renaming column in postgresql (#2099) 2017-06-10 00:53:25 +03:00
Richard Ižip
3d9316686a Add unit test for cross-join (#2102)
* Test composition of two cross joins

* Test cross-join with 'on' statement
  (same as inner join) only for sqlite3 and mysql
  because not supported elsewhere
2017-06-10 00:29:56 +03:00
Ronny Badilla
198da1b273 Change the way that MySQL verifies if a table exists (#2097) 2017-06-09 23:19:37 +03:00
Philipp Beck
fe17280d8b Fix falsly setting autoTransaction (#2113)
When passing a falsy value to transacting a new transaction is created but autoTransaction is set to false so the created transaction is never committed or rolled back.
2017-06-09 22:06:15 +02:00
smulesoft
31ba04a788 fixes #1833 on postgres (#2017)
* fixes #1833 on postgres

* adds @elhigu requested changes

* adds test when database is down

* adds script for docker support

* removes old comment

* fixes syntax

* fixes more syntax errors

* fixes final syntax errors

* Docker testing enabled only on linux for now
2017-06-01 22:41:35 +03:00
irsl
a47a077330 Field identifiers were not quoted properly in Sqlite3 dialect (#2087)
* field wrapping changed from quotes to backticks in sqlite3 dialect; unit tests adjusted accordingly

* addColumn was accidently removed
2017-05-28 23:48:18 +03:00
ncwgf
17bf763cb1 Support node-mssql 4.0.0 (#2029)
* compatible node-mssql 4.0.0

compatible with 3.3.0 & 4.0.1

tgriesser/knex#1999

* Fix format ESLint max-len 100

eslint src/**
src/dialects/mssql/index.js
  77:1  error  Line 77 exceeds the maximum line length of 100  max-len

* node-mssql 4

* add package mssql-node to dev
2017-05-21 15:41:15 +03:00
dirkmc
67951700ca Fix mssql binding ordering for queries that combine a limit with select raw or update (#2066)
* Fix binding ordering for queries that combine a limit with a select raw or update

* Use old school quotes so tests pass
2017-05-16 13:51:24 +03:00
guanghui
a7639c34af fix incorrect parameter name (#2068) 2017-05-16 13:17:19 +03:00
GONZO
68af752bbe fixed table alter attributes order. (first, after) (#2062)
* fixed table alter attribute order. (first, after)

* add test cases, alter table position with comment.

* add real database test cases.

* after, first tests only mysql or mariadb.
2017-05-15 13:16:15 +03:00
Mikael Lepistö
68584a7311 Added requirement of integration tests
There has been many PRs which are changing what kind of queries are sent to DB without any real tests that also checks that sent queries are doing the things that they are supposed to do. To be able to make sure that those new queries actually work, in addition to unit tests it is crucial to have some integration tests as well to be able to guarantee that everything won't be broken after the changes.
2017-05-11 13:14:44 +03:00
Carlos Ramos
18581f9632 Add support for enum columns to SQlite3 dialect (#2055) 2017-05-10 20:04:13 +03:00
Jonathan Stewmon
804c338dd0 remove configOptions connection settings filter for mysql2 (#2040) 2017-05-09 08:55:00 +03:00
Mikael Lepistö
ead4df329b Fixed version number to not crashloop documentation building 2017-05-05 17:28:51 +03:00
Mikael Lepistö
314dcadd52 Changelog + version for 0.13.0 release 0.13.0 2017-04-29 17:39:57 +03:00
Alexandre Tiertant
dd3289be94 Add fetchAsString optional parameter to oracledb dialect (#1998)
* Add optional parameter fetchAsString to oracledb

* Add some checks to oracle fetchAsString

* use const instead of let

* add fetchAsString test

* change const to var in tests

* move oracle driver specific test to bottom

* fix fetchAsSting multiple instance

* Fix tests

* replace const to var in test

* Rework Oracle fetchAsString tests

* remove const

* remove done and timeout
2017-04-28 13:47:24 +03:00
Tjerk Santegoeds
5c0b193fec fix: escapeObject parameter order for Postgres dialect. (#2003)
* fix: escapeObject parameter order for Postgres dialect.

* test: escapeObject for Postgres dialect.
2017-04-12 13:57:27 +03:00
itaysabato
a5f4c39529 Migration transaction (#1962)
* Use transaction for entire migration batch + locking if all migrations are transactional.

* Fix tests.
Use knex instead of query builder.
Do no use single transaction if `disableTransactions` is true.

* Added tests for parallel migrations.
Subtract already done migrations after getting the lock, when there is a wrapping transaction.

* Fix indentation.

* Fix linting errors (which are locally warnings, for some reason).

* Remove `const` keyword.
Remove obsolete `it` clauses.

* No maria. PG first.

* Test only pg and oracle.

* Remove error swallowing.

* Test parallel migration only in postgres (select for update works differently in other databases).

* Add transaction to missed places.

* Remove ignored table name argument.

* Enabled parallel migrations test for `mssql` dialect (still not part of CI test).
Fixed indentation.
2017-03-27 17:39:08 +03:00
Mikael Lepistö
137e1fe987 Allow passing version of connected db in configuration file (#1993)
* # This is a combination of 3 commits.
# The first commit's message is:
Allow passing config.version variable to knex instead of parsing the DB version from string returned form DB server.

This makes it possible to connect custom databases which are compatible with an official database of certain version.

# The 2nd commit message will be skipped:

#	Update checkVersion
#
#	To use `const` instead of `let` to fix lint error

# The 3rd commit message will be skipped:

#	Revert "Update checkVersion"
#
#	This reverts commit 248907decb94f0df2f2b3b9fe114738fb48394fc.

* Allow passing config.version variable to knex instead of parsing the DB version from string returned form DB server.

This makes it possible to connect custom databases which are compatible with an official database of certain version.
2017-03-27 00:21:15 +03: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
876f615f61 Increase test timeout 2017-03-24 16:14:25 +01:00
wubzz
04981a2700 Fixed timing issue on commit 2017-03-24 10:52:38 +01:00
wubzz
b06b8bfa29 Restore release.sh 2017-03-23 15:27:19 +01:00
wubzz
ce375c5423 release 0.12.9 0.12.9 2017-03-23 15:26:44 +01:00
wubzz
620ade8c6d Updated changelog for 0.12.9 2017-03-23 15:25:57 +01:00
wubzz
50557f7571 Ensure errors in batchInsert do not end up 'unhandled'. Fixes #1880 (#1984) 2017-03-22 21:44:36 +01:00
Mikael Lepistö
33ad09379e Added information about accidental breaking change in 0.12.7 to changelog 2017-03-16 09:42:45 +02:00
wubzz
f67daaeef5 Restore release.sh script 2017-03-15 22:50:49 +01:00
wubzz
dbdc93cc8f release 0.12.8 0.12.8 2017-03-15 22:49:55 +01:00
wubzz
2eb1a8ae83 Update changelog for 0.12.8 2017-03-15 22:46:30 +01:00
wubzz
10a6505bec Must always clear the timeout for handling 'acquireConnectionTimeout', even if an error occurs. Fixes #1973 (#1974) 2017-03-15 22:43:37 +01:00
wubzz
b722753ea3 Transaction should not reject with undefined. (#1970) 2017-03-14 21:56:32 +01:00
Casey Foster
19ed460f8b Properly close PG query stream on error (#1935)
Without calling `close()`, the `queryStream` will continue to execute a
query meaning there was no way to halt a long running query due to an
unrecoverable downstream error. I ran into this issue while streaming
IDs from a very large table as part of an ETL process. An error would
occur downstream in the transformation or loading step and I needed to
cancel the long-running extract stream, but there was no way to do so
and I'd eventually run out of connections in the pool.

This commit also handles the case when the non-callback version of
stream API was used and an exception was thrown. The issue was that the
promise was not reachable and therefore there was no way to add a
rejection handler. This resulted in an unavoidable `Unhandled Promise
Rejection` error.
2017-02-24 11:55:13 -05:00
Alec Hirsch
9404dba928 added clearSelect and clearWhere to query builder (#1912) 2017-02-20 20:12:14 +02:00
Mikael Lepistö
364d23b3b0 Update changelog for release 0.12.7 2017-02-17 01:13:39 +02:00
Danny Fritz
43324d7503 🔧 Ignore stub files in lint task (#1649) 2017-02-17 00:39:42 +02:00
vellotis
fe4ec15ae0 Support custom foreign key names (continued work of #1311) (#1726)
* Added support for custom foreign key name

* Update unit test for #1311

* Fix TableCompiler::foreign to respect previous behavior + typo

* Add dialect specific unit tests

* Fixed comment

Actually trying to trigger travis to run tests with latest travis configuration... (maybe it just doesn't run tests against merged branch..)
2017-02-17 00:35:43 +02:00