23 Commits

Author SHA1 Message Date
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
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
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
Sky Morey
198aa0db4b fixed lint issues, fixed mssql transaction 2015-12-10 13:35:37 -06:00
Sky Morey
afd6b66624 Final build of mssql provider, all tests pass 2015-12-09 17:53:53 -06:00
Hannah Wolfe
f72892b5b9 Distinct modifier support for aggregate functions
closes #1028

- add support for count(distinct *), avg(distinct *) and sum(distinct *)
- min and max don't really make sense with distinct, so didn't add those
2015-11-09 12:48:42 +00:00
Tim Griesser
471b2bae8f Bump sqlite3 test dependency for 0.12 2015-04-28 23:32:41 -04:00
Tim Griesser
e011768124 Adding back debug 2015-04-28 19:34:11 -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
Ben Drucker
7cdda834ef Remove FoundationDB
Reverts c199761c597c93136a6d38bc4ecf26a693560322 and #641

Foundation was acquired and shut down immediately
2015-03-24 17:48:14 -07:00
Nathan Williams
2d6d2f28f7 Adapter for FoundationDB SQL Layer 2015-02-04 14:56:41 -05: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
Tim Griesser
db2f9e7f08 merge with master 2014-04-16 02:50:19 -04:00
Tim Griesser
8bddaea5e2 adding several tests from recent modifications 2014-02-21 20:38:14 -05:00
Tim Griesser
4c589cc960 working on refactoring the internals 2014-02-14 12:46:13 -05:00
Nikhil Benesch
0bf4044b74 Add 'avg' aggregate function
The 'AVG' aggregate function is specified in the SQL standard and
supported by MySQL, PostgreSQL, and SQLite. Include tests, too.
2014-01-19 15:38:59 -05:00
Luigy Leon
6f967003d4 Failing test for #108 2013-11-23 12:10:01 -05:00
Tim Griesser
b20c6c3f8e swapping in bluebird, some promise cleanup 2013-10-27 22:34:58 -04:00
Tim Griesser
0ae10c3236 fixing query ordering in tests 2013-09-13 18:48:28 -04:00
Tim Griesser
1a47485d33 integration tests are workinggit st 2013-09-12 13:30:47 -04:00
Tim Griesser
48563dfd31 sqlite3 mostly working except for the schema things 2013-09-12 01:00:44 -04:00
Tim Griesser
634f4751a1 mysql and pg are mostly working, now onto sqlite3 2013-09-11 23:36:55 -04:00