31 Commits

Author SHA1 Message Date
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
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
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
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
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
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
c2c31ce859 Change default constraintName in .primary() to match docs and .dropPrimary() 2016-05-19 22:13:09 +02:00
wubzz
4ba581b362 Fix some unit tests 2016-05-19 21:36:30 +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
Mikael Lepistö
2f531190bb Merge pull request #1109 from kmikael/timestamps-now
Add option to timestamps to be not null and default to the current timestamp
2016-03-15 23:09:16 +02:00
wubzz
82b38740b7 Forgot to commit the updated Test for dropPrimary 2016-01-29 23:55:51 +01:00
Mikael Konutgan
aa142f20f7 Add option to timestamps to be not null and default to the current
timestamp
2016-01-25 16:35:58 +01:00
Mikael Lepistö
0ac6152c7f Jsonb type to schema. 2015-11-04 13:46:34 +02:00
Daniel Teixeira
8e780a8115 rename .using to .withSchema 2015-08-14 19:17:06 -03:00
Daniel Teixeira
3f8f50425f add schema support for schema builder 2015-08-09 23:04:53 -03: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
Tyler Kellen
2ddbfb65c4 support creating and dropping extensions in postgresql 2014-11-08 10:14:01 -05:00
Brian Delahunty
f73b62577a Add additional unit test to cover case where no index name is specified in fluent version 2014-10-02 21:03:24 -07:00
Brian Delahunty
9be8e7b601 Add support for specifying the postgres index type. 2014-10-02 20:56:39 -07:00
Ben Drucker
40effe848a Allow jsonb columns to be created with the schema builder
Closes #499
2014-09-22 12:25:28 -04:00
Vincent Schoettke
f3874ac651 Fixed several jshint warnings. Added strict mode 2014-09-01 17:19:34 +02:00
Vincent Schoettke
02eb8cbe5e More thorough test of query builder 2014-08-26 23:05:39 +02:00