49 Commits

Author SHA1 Message Date
Mr D
369bbd6293
Improve Esm interop (#3985)
refs #3978
2020-08-16 19:22:26 +03:00
Mr D
907cc763f6
#3978 Improve mjs module support (#3980) 2020-08-15 17:54:43 +03:00
Mr D
cfce685775
ESM module interop fails if calling module/package is of type 'module' #3937 (#3938) 2020-08-08 17:39:57 +03:00
Igor Savin
c0afe14cde
Warn user if custom migration source is being reset (#3839) 2020-05-06 00:13:09 +02:00
Igor Savin
38f54ce8f0
Refactor migration logic to use async/await. Add test case for using classes with custom migration sources (#3838) 2020-05-05 19:10:50 +02:00
Zach McElrath
b626702b47
Add migrate:unlock command, truncate on forceFreeMigrationsLock (#3822) 2020-04-23 21:51:32 +02:00
Lorefnon
7b4d208bae
Fix inferrence of seed/migration extension from knexfile extension (#3814)
Current implementation doesn't work when knexfile has multiple env-specific configuration sections.

Resolves #3807
2020-04-20 01:19:15 +02:00
Igor Savin
e37aeaa31c
Prepare for 0.21.0 release (#3811) 2020-04-19 00:40:23 +02:00
Florent Vilmart
41d02ba5c1
CLI: adds support for asynchronous knexfile loading (#3748) 2020-03-24 17:07:05 +01:00
Kabir Baidhya
a6551559f0
Minor improvements on the usage of fs utilities - unify all the fs functions into the same util/fs to simplify things (#3749) 2020-03-24 15:50:47 +01:00
Brian Lauber
2c206a8fec
Fix: Knex CLI calls process.chdir() before opening Knexfile (#3661) 2020-02-13 08:58:33 +01:00
Brian Lauber
947273e24a
Improve Support for Liftoff's Preloaders (#3613) 2020-02-08 17:23:44 +01:00
Mr D
65086025c0 #3751: Esm interop flag (#3616) 2020-01-14 21:01:31 +01:00
yeonhoyoon
4a2fa3b6c9 Print help only when there are no arguments (#3617) 2020-01-14 20:58:28 +01:00
James George
df2ace1915 fix: prevent warning with root command (#3604) 2020-01-04 22:57:12 +01:00
Jiri Spac
e1191ce909 make sure CLI works for namespaced knex packages as well (#2539) 2019-11-25 01:44:43 +01:00
maximelkin
531714804b Use util.promisify instead of Bluebird.promisify (#3470) 2019-10-15 09:11:59 +02:00
Lorefnon
b0c0db601a Fix some issues around seed and migration generation (#3479) 2019-10-13 13:19:53 +02:00
Taras Ozarko
7fabae9f56 Migrations up/down commands: filename parameter (#3416) 2019-10-06 18:00:04 +02:00
Vithalreddy.M.B
658e612148 knex cli list all migrations with status (#3390) (#3409) 2019-08-24 12:01:12 +02:00
Ricardo Graça
9aa7085b05 Rename src directory to lib (#3338) 2019-07-10 23:48:43 +02:00
Bohdan Shulha
c6481e8c97 fix: Respect the knexfile stub option while generating a migration (#3337) 2019-07-10 21:45:47 +02:00
Felix Mosheev
8b31a43761 feat: Run specific seed file (closes #801) (#3335) 2019-07-07 11:11:39 +02:00
Vamp
2b6333249a CLI: add --stub option to migration:make (#3316) 2019-07-04 22:08:01 +02:00
Ihor Sakaylyuk
0a85331525 CLI: Fix empty --version output (#3312) 2019-06-30 18:23:50 +02:00
Igor Savin
858c7b6f1e
Fix extension resolution from env configs (#3294) 2019-06-19 01:33:16 +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
c431ffc35a
Drop support for Node.js 6. Remove babel. (#3227) 2019-06-04 00:37:17 +02:00
Lee Allen
1fe5ee0ea3 Add migrate:down functionality (#3228) 2019-05-30 00:37:18 +02:00
Zachary Mott
f4593fb9b4 Allow users to specify the migrations "tableName" parameter via the CLI. (#3214) 2019-05-21 17:41:50 -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
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
Adrien Risser
08ae1ec2a6 Add error detail log to cli.js (#3149) 2019-04-28 20:41:49 +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
Jorge Bucaran
a3766e6229 perf: swap chalk→colorette / minimist→getopts (#2718)
* perf: replace chalk/minimist with colorette/getopts

* Use fixed versions
2018-12-30 17:25:48 +01:00
Valentin Agachi
2430ae0c54 Add verbose option to CLI commands (#2887) 2018-12-30 17:11:57 +01:00
Igor Savin
02e327c51d Resolve migrations and seeds relatively to knexfile directory (#2959) 2018-12-17 14:51:35 +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
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
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
887fb53929
CLI cleanup. Do not require client for creating seeds or migrations (#2905)
* Specify jakefile explicitly to ensure it being run. Do not require client when creating seeds or migrations. cli.js cleanup. Formatting

* Fix message

* Fix typo

* Ignore console rule in CLI tests

* Fix rimraf import

* Improvements after code review

* One more arrow function
2018-11-16 13:23:22 +01:00
Aurélio A. Heckert
bb5da4b200 Migrations with CLI and without knexfile (#2884)
* Migrations with CLI and without knexfile

Allows to create and run migrations.

closes #2819

* Apply tweaks to migrate without knexfile

Thanks to @kibertoad comments!
The bigger change was to remove the bash script to test knex's cli command, and replace it with a jake file. I believe this jake file may be used as a base for future cli tests.

* Replace `fs.promises` with `new Promise`
2018-11-06 11:03:18 +02:00
Tim Griesser
232fe9f151
Add Prettier (#2697)
* Add prettier
* Run files through prettier
2018-07-09 08:10:34 -04:00
P-Seebauer
15706c0d00 2351 CLI sets exit-code 1 if the command supplied was not parseable (#2358)
* CLI Sets exit code to 1 if the command wasn't parseable

* Fix color output for errors in the cli
2018-01-19 00:29:38 +02:00
Saugat Acharya
ff4f9e213b align commands description (#1857) 2017-01-11 15:02:24 +02:00
Prashant Tiwari
ba5ae37097 Support knexfile, migration and seeds in TypeScript (#1769)
* Support knexfile, migration and seeds in TypeScript

* Look for .ts seed files

* Fix linter warning for max-len

* Enforce migration scripts to return a promise

* Remove Promise.all example from stub
2016-12-01 10:32:21 +02:00
Tim Griesser
d1a55a907d Moving bin/cli outside of src to allow install from master 2016-09-13 09:31:58 -04:00