33 Commits

Author SHA1 Message Date
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
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
Tim Griesser
232fe9f151
Add Prettier (#2697)
* Add prettier
* Run files through prettier
2018-07-09 08:10:34 -04: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
Mikael Lepistö
e2f617b968
Drop mariadb support (#2681)
* Dropped support for mariasql

* ESLint
2018-07-01 23:06:26 +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
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
Joel Mukuthu
bf1fa63118 Add queryContext to schema and query builders (#2314)
* feat(query-builder): add hookContext for wrapIdentifier

* refactor: use isUndefined

* test(transaction): test passing of hookContext

* feat(runnner): pass context to postProcessResponse

* test(runner): test postProcessResponse for raw responses

* test(raw): test passing of hookContext

* feat: add hookContext to Raw and SchemaBuilder

* test(transaction): fix test for hookContext

* chore: fix lint error

* fix: check for hookContext before calling it

* test(transaction): fix hookContext test

* chore: remove whitespace

* test(hookContext): test cloning of context object

* refactor: hookContext -> queryContext

* minor: use more descriptive variable name

i.e. refactor: `context` => `queryContext`

* fix: remove unnecessary checks for query builder

* fix(Raw): pass query builder to formatter

* fix(SchemaCompiler): pass schema builder to formatter

* refactor: add addQueryContext helper

* feat: add queryContext to TableBuilder and ColumnBuilder

* fix(TableCompiler): pass table builder to formatter

* fix(ColumnCompiler): pass column builder to formatter

* fix(pushQuery): fix passing builder to formatter

* test(Schema|Table|ColumnCompiler): test passing queryContext

* fix(SchemaCompiler): pass queryContext to TableCompiler

* fix(TableCompiler): pass queryContext to ColumnCompiler

* test: add queryContext tests for all schema dialects

* test(TableCompiler): test overwriting queryContext from SchemaCompiler

* test(Raw): test passing queryContext to wrapIdentifier

* tests: run all the tests
2018-02-02 00:41:01 +02:00
Ivo Meißner
fbf371f4e9 Added decimal variable precision / scale support (#2353)
* Added postgres decimal variable precision / scale support

* Decimal column no precision support all dialects + tests
2017-11-30 23:05:39 +02:00
Richard Ižip
74f2a031f3 Throw error on non-string table comment (#2126)
* Throw error on non-string table comment

* add unit tests for all dialects
* removed non-valid comments retyping to ''

* Change dockerode version

* reverted dockerode version locking
2017-11-01 00:22:07 +02: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
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
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
Mikael Lepistö
77e67334a3 Alter column syntax for table, implements changing type, nullability and default (#1914)
* Added support for altering columns

* Add mysql dialect key for alter (modify)

* Added tests for .alter()

* Updated dialects for .alter() on column

* .alter() for mssql and tests

* Added an error for sqlite3 alter column

Sqlite does not support alter column at all

* Implemented schema alter column support for postgresql

* Added unit test for alter column and fixed postgres implementation

* Add test case for adding multiple columns at once (oracle check)

* Try upgrading CI mysql / postgres and distro

* Disabled adding multiple columns test from oracle

* Fixed node 0.12 test compatibility

* Fixed review comments
2017-02-16 20:34:59 +02:00
wubzz
5a6ab64d06 Ensure .primary() and .dropPrimary() are the same across all dialects. 2016-05-19 21:30:17 +02:00
Max Claus Nunes
8d6264e96b wrap index names 2016-03-16 21:52:51 -03:00
Joe Frambach
cf8222d9eb Add inherits to postgres. Updated dialect-specific methods. 2016-03-15 16:40:49 -07:00
Alexander Sagen
2317279e8c Add collate for columns (MySQL)
This had been requested in #599 a year ago, but a PR was never created.

I have included a test that passed when i ran it.
2016-01-19 23:06:25 +01:00
Tim Griesser
c8232d11d3 Merge with master, cleanup on mysql2/maria 2015-04-22 16:19:59 -04:00
Tim Griesser
865fa6a1fe Putting the old dir structure back 2015-04-22 11:52:34 -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
Tim Griesser
eee4e9c005 Fixing the overall class dependency approach, lots of internal cleanup, WIP 2015-04-19 16:31:52 -04:00
Tim Griesser
d4349a9cff Add default as alias for defaultTo 2014-09-02 10:54:07 -04:00
Vincent Schoettke
f3874ac651 Fixed several jshint warnings. Added strict mode 2014-09-01 17:19:34 +02:00
hsz
1077d11bc3 chainable-first method for MySQL 2014-07-30 10:54:29 +02:00
Tim Griesser
a24dedb567 Remove weird git whitespace 2014-06-12 14:07:33 -04:00
Tim Griesser
1e936ffd3c Fix #308 onDelete / onUpdate in PostgreSQL, with tests 2014-06-12 14:00:44 -04:00
Tim Griesser
c804822c6d release 0.6.9 2014-06-09 21:28:49 -04:00
Tim Griesser
6b85f1d66f Merge with master, ensure #278 is fixed in 0.6 2014-06-04 11:29:21 -04:00
Tim Griesser
a62ca4f7ee schema tests passing, some of the builder tests passing 2014-04-15 11:43:47 -04:00
Tim Griesser
eeeab07c42 reworking where values are parametereized/escaped 2014-03-14 16:56:55 -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