Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create migrations with the CLI without knexfile #2819

Closed
bertho-zero opened this issue Sep 26, 2018 · 4 comments · Fixed by #2884
Closed

Create migrations with the CLI without knexfile #2819

bertho-zero opened this issue Sep 26, 2018 · 4 comments · Fixed by #2884

Comments

@bertho-zero
Copy link
Contributor

Feature discussion / request

It would be convenient to be able to create migrations without knexfile, one could pass the required arguments to the CLI.

In my case only client or dialect is necessary but one can also imagine passing the directory of the migrations or other by the arguments.

knex migrate:make create_rule_table --client mysql --directory ./migrations
@elhigu
Copy link
Member

elhigu commented Sep 26, 2018

Why do you need that?

Currently big problem with command line client is that it really doesn't have any tests. So until someone writes some test setup for running tests for it we have not been accepting any additions to that part of knex.

@kibertoad
Copy link
Collaborator

Some projects don't have knexfile in the first place and only pass config to knex instance programmatically. I've seen projects with fictitious knexfile just for generating migrations.
So if someone volunteers to make a solution for testing CLI, this feature request could proceed?

@elhigu
Copy link
Member

elhigu commented Sep 26, 2018

Sure, this is not the first time that something like this has been requested.

aurium pushed a commit to aurium/knex that referenced this issue Oct 28, 2018
Allows to create and run migrations.

closes knex#2819
elhigu pushed a commit that referenced this issue Nov 6, 2018
* 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`
@bertho-zero
Copy link
Contributor Author

Thank you so much !

mwilliammyers pushed a commit to voxjar/knex that referenced this issue Dec 12, 2018
* Migrations with CLI and without knexfile

Allows to create and run migrations.

closes knex#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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants