kysely-org / kysely-ctl

Command-line tool for Kysely
MIT License
71 stars 2 forks source link

allow stub templates #90

Open pbrink231 opened 1 month ago

pbrink231 commented 1 month ago

I have seen in other migration cli's the use of stubs which are really nice.

I am thinking a command like npx kysely migrate:stub {stub_name} {migration_name}

Would need to add a stubsFolder option under migrations option in the config file

Then I could have a folder called whatever I want with file names like: my_stub_file.stub. This file would be just like your template file in your src->templates folder.

When the migration is created it will use the stub file as the template, name the file as it does now and use the correct extension.

igalklebanov commented 1 month ago

Hey 👋

Thank you for raising this! 🙏

Looking at https://github.com/knex/knex/pull/3316, knex's stub feature works a bit differently. A --stub flag on migrate:make and seed:make that can accept a filename (looks for it in the migrations/seeds folder) or a path relative to the config file. There is no stubs folder.

This is a welcome enhancement, and gets us closer to 100% knex CLI coverage.