1117 Commits

Author SHA1 Message Date
Igor Savin
f328fbbdb4
Expose executionPromise for transactors (#3297) 2019-06-19 22:12:21 +02:00
Igor Savin
858c7b6f1e
Fix extension resolution from env configs (#3294) 2019-06-19 01:33:16 +02:00
Igor Savin
5301b29186
Prepare for 0.18.0-next1 release (#3291) 2019-06-18 01:36:28 +02:00
Igor Savin
f392b5cef3
Remove Bluebird.method and one instance of .bind (#3290) 2019-06-18 00:07:24 +02:00
Benjamin Ki
9d8e900050 refactor: replace usage of Bluebird Promise.tap with native Promise.then (#3287) 2019-06-17 13:00:31 +02:00
Igor Savin
1e950b93e4
Name Bluebird usage explicitly. Remove spread and thenReturn (#3285) 2019-06-17 02:14:17 +02:00
Igor Savin
04b12f234b
Use extension from knexfile for generating migrations unless overriden (#3282) 2019-06-14 08:44:02 +02:00
Chris Allen
a65a95bc67 Use migrations.extension from config when generating migration (#3242) 2019-06-13 23:32:03 +02:00
Igor Savin
5eaac66ea5
Merge 0.17 into master (#3277) 2019-06-11 02:05:31 +02:00
Igor Savin
4b6429ebf9
Reduce bluebird usage (#3267) 2019-06-08 02:34:41 +02:00
Igor Savin
c431ffc35a
Drop support for Node.js 6. Remove babel. (#3227) 2019-06-04 00:37:17 +02:00
Adrien Risser
9b74ccbfad Fix error message bubbling up on seed error (#3248) 2019-06-03 18:10:23 +02:00
Lee Allen
1fe5ee0ea3 Add migrate:down functionality (#3228) 2019-05-30 00:37:18 +02:00
Igor Savin
f599f6ac13
Try using much smaller timeouts (#3226) 2019-05-27 23:21:21 +02:00
Igor Savin
5307dacc66
Implement support for returning started transaction without using transaction() methods callback function (#3099) 2019-05-26 18:03:07 -07:00
Lorefnon
54a7a4a35f Support multi-column whereIn in sqlite through values clause (#3220)
Fixes #3042
2019-05-25 12:53:20 -07:00
Zachary Mott
f4593fb9b4 Allow users to specify the migrations "tableName" parameter via the CLI. (#3214) 2019-05-21 17:41:50 -07:00
Lorefnon
e2e044c0f2 Unify object options handling for datetime/timestamp across dialects and update type definitions (#3181)
* Fix windows incompatiblity in npm scripts

* Update timestamp and datetime signature in oracle dialect to be consistent with other dialects
2019-05-19 05:10:59 -07:00
Lee Allen
08478f2db9 Feature/add up for migrations (#3205)
* Add ability to run migrate:up command to only run the next migration

* Add cli test for migrate:up

* Add test for migrator

* Add stub

* Add type

* Fix wording of test
2019-05-19 04:14:52 -07:00
Igor Savin
f34013be5f
Use cli-testlab for testing CLI (#3191)
* Bump version to 0.16.4

* Use cli-testlab for testing CLI
2019-05-13 13:39:02 +02:00
Mikael Lepistö
8a9a648ae2
Docker based test dbs (#3157)
* Fixed some of the tests failing with various dialect combinations

* Setup all test databases to run in docker

* Fixed test suite and updated travis to use docker

* Fixed some tests in master and disabled oracle tests while setting everything else to work again

* Changed docker to use latest postgresql alpine image

* Re-enabled all oracledb tests

* Install oracle client libs to oracle server and copy them to travis to make node oracledb package to work

* Disabled random failing oracle tests and added test to show that oracle update in transaction does not seem to work ACID

* Update package.json

* Update package.json

* Fixed linting issues

* Fixed waiting for postgres to use the same DB image that database is using.

* Removed installing oracledb driver in travis if not needed .travis.yml

* Cleaned up package.json more

* Created static name for oracledb container to allow copying files out of it on different docker versions

* Removed webpack from deps
2019-05-13 12:21:36 +03:00
Daniel Mills
617d36ea01 add clearHaving function and add test (#3141) 2019-05-12 10:20:26 +02:00
Lee Allen
75df3b6f7b Feature/add rollback all to cli (#3187)
* Add --all flag for rollback in cli

* Set up test for rollback --all cli migration command

* Fix test for cli migrate:rollback --all
2019-05-12 01:35:51 +02:00
Lee Allen
a2ab754eed Bugfix/rollback all wrong order (#3172)
* Fix rollback all bug attempting to perform rollback in chronological order

* Set up second migration to depend on first migration so when rolling back order is tests

* Add test for rollback all only running completed tests in reverse chronological order
2019-05-01 00:21:49 +02:00
Igor Savin
fe6083eda4 Support nullable timestamps on MySQL (#3100)
* Add test to recreate the issue

* Improve test, add some documentation

* Improve test

* Add explicit nullable flag to column

* Set nullability explicitly on MySQL to deal with timestamp edge case

* Use same assertion for everything
2019-03-30 15:58:56 +02:00
Andrew Schmadel
b15ee3def1 make unionAll()'s call signature match union() (#3055)
* make unionAll()'s call signature match union()

consolidates the logic used by union() and unionAll(), allowing the two to be used interchangeably

* use spread args instead of arguments array

* Fix unionAll spread arguments
2019-03-29 19:55:32 +02:00
Igor Savin
e7ed005995
Fix queryContext not being passed to raw queries (#3111)
* Fix queryContext not being passed to raw queries

* Add unit case for transaction as well
2019-03-19 00:45:08 +01:00
elunic
19926d8eba [#3033] fix: sqlite3 drop/renameColumn() breaks with postProcessResponse (#3040)
* [#3033] fix: sqlite3 drop/renameColumn() breaks with postProcessResponse

* When postProcessResponse is configured, and client.processResponse()
returns a Promise (e.g. for custom cases such as sqlite3 dropColumn()),
then that Promise is not awaited, but handed to postProcessResponse,
which might break is (e.g. with Objection's knexSnakeCaseMappers()).

* when reinserting data in the modified table, the rows are now being
handled with the "mapped" identifiers (instead of the unmapped)

* add tests, fix hasColumn

* add hasColumn tests for add mysql + snakeCaseMappers

* Improve tests and fix more cases related to processing

* Fix SQLite-specific tests

* MySQL is not case-sensitive, pg is
2019-03-13 22:58:59 +01:00
Igor Savin
24fcf27e05
Fix transaction support for migrations (#3084)
* Fix transaction support for migrations

* Clarify warning

* Clarify warning message

* Simplify logic, make enabling/disabling more consistent

* Fix tests

* Fix test

* Reduce duplication
2019-03-13 22:47:43 +01:00
Pierre Voisin
0aacab50be Fix for #2998 - Migrator & TypeScript (#3041)
* Fix `#listAllAndCompleted` not considering `loadExtensions` in migrator configuration (#2998)

* Add unit test

* Fix linting
2019-03-09 23:39:55 +01:00
EthanHur
0db785949b add test that clearing offset (#2954)
* add test that clearing offset

* fix typo
2019-03-05 16:25:30 +01:00
Igor Savin
1b39d67550
Tests for drop-and-recreate with async/await (#3083)
* Add test for drop-and-recreate with async/await

* Add some tests with schema

* Use correct migrations

* Add tests with promise chains for comparison

* Fix migration

* Fix Node 6 compatibility
2019-03-05 01:03:51 +01:00
Randy Garces
c2bf7a375c MSSQL removes support column width/length on data type int and tinyint (#2738)
* MSSQL remove support column width/length on data type int

- fixes error `Cannot specify a column width on data type int`
- ignore length even if pass as agrument

* Add integration test for numeric lengths

* Fix syntax

* Add test that actually executes SQL

* Fix failing tests

* Fix tests
2019-03-05 01:02:06 +01:00
Igor Savin
b269e45842
Update dependencies (#3085)
* Update dependencies

* Fix linting errors
2019-03-04 01:40:35 +01:00
thekuom
71e097b663 add intersect() (#3023)
* add intersect()

* update intersect integration tests to validate results

* use const instead of var, remove .only in test, remove commented out type
2019-03-03 20:57:40 +01:00
EthanHur
dfe01298d2 mysql warn .returning() does not have any effect. (#3039)
* mysql warn `.returning()` does not have any effect.

* add test if warning is emitted or not
2019-03-03 14:53:06 +02:00
Igor Savin
26868f864c Fix event listener duplication (#2982)
* Fix event listener duplication. Start executing more tests in CI; fix broken test.

* Fix listener

* Fix listener

* Fix Node 6 support

* There doesn't seem to be a clear way to fix listener behaviour in Node 6, so let's just ignore it for the time being, especially considering that we are dropping support for Node 6 in April anyway.

* Update migration guide
2019-01-31 07:23:05 +02:00
James Beavers
816695bdbf Always use well documented pg client query() config argument (#3004)
* always use well documented query config argument

* fix options typo
2019-01-19 13:26:51 +02:00
Valentin Agachi
2430ae0c54 Add verbose option to CLI commands (#2887) 2018-12-30 17:11:57 +01:00
Igor Savin
9daf7f3d09
Display name of a failed seed (#2973) 2018-12-27 18:20:13 +01:00
André Cruz
c2dff7f843 Implemented extra boolean param for rollback() (#2968)
* Implemented extra boolean param for rollback()
Extra parameter allows all migrations to be rolled back.

* Removed spurious log

* Removed stray debugger instruction

* Moved to arrow functions
2018-12-20 17:05:28 -06:00
Igor Savin
02e327c51d Resolve migrations and seeds relatively to knexfile directory (#2959) 2018-12-17 14:51:35 +02:00
Igor Savin
ff75f1d2bd
Do not reset prior Promise overrides on knex import (#2944)
* Do not reset prior Promise overrides on knex import

* Do not leak global state outside of the test
2018-12-10 18:20:06 +02:00
Igor Savin
ac6423f3b3 Fix support for default knexfile in working dir (#2941)
* Fix support for default knexfile in working dir

* Bump version

* Remove incorrect comment
2018-12-05 09:30:55 +02:00
Igor Savin
1cd1f079f8
Apply postprocessing in migrations (#2934)
Apply postprocessing in migrations
2018-12-03 23:47:09 +01:00
Igor Savin
8dc0a716f9
Fix CWD parameter support for CLI (#2935)
* Fix cwd support for knex-cli. Add test

* Remove redundant code

* Remove commented out code
2018-12-03 23:14:34 +01:00
Igor Savin
0115f933ca
Align signature for PG datetime and timestamp methods with docs (#2919)
* Align signature for PG datetime and timestamp methods with documentation. Add precision support

* Remove redundant method

* Add upgrade note for the change

* Changes after code review

* Improve API
2018-11-26 10:22:27 +01:00
Randy Garces
ab35e97614 GH-2915 Oracledb tests are failing (#2924)
* GH-2915 Oracledb tests are failing

- fixes oracledb failing tests

* Fixes oracledb increment() and decrement() empty query

- Error: The query is empty

* Add ToDo for fixing Oracle bug
2018-11-23 12:58:23 +01:00
Igor Savin
461868b614
Fix knexfile resolution. Add missing test (#2923)
* Fix knexfile resolution. Add missing test

* Try fixing Jake test execution

* Avoid having non-test files in jake folder

* Fix test compatibility with Node 6

* Fix the fix
2018-11-22 10:19:06 +01:00
Igor Savin
1eac063b28
Do not postprocess internal queries in Migrator (#2914)
* Do not postprocess internal queries in Migrator

* Fixes

* Fix var -> const autofix

* Fix regression
2018-11-19 12:55:50 +01:00