-
Notifications
You must be signed in to change notification settings - Fork 28
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
populateDb expects seed files that export a function, but knex seed files exports.seed #61
Comments
bump |
Sure, I will gladly merge PR if you like to fix that. That commit seems legit fix 👍 |
even that it is kind of a bug fix I'll mark it as breaking change, since old seeds if someone has used them will not work anymore. |
I have a updated fix (with passing tests). I can create another PR, but was thinking about that breaking change comment. |
Actually I hate having any seed support in knex / knex-db-manager (IMO they are completely useless for any non-trivial app and in test suite it is easier to write just custom methods as a part of test setup containing DB population functionality). So whatever works for me 😅 One could even dynamically check if there is module.seed run it and if it is a plain function then run the plain function. |
Hi,
Have been using this package for awhile but recently started using it for seed files.
I've noticed that populateDb looks for a glob pattern of files, requires those files, and then checks to see if the module is a function. However, when generating knex seed files, the templates look like:
Where the module being loaded in knex-db-manager is
{ seed: [AsyncFunction] }
. Therefore seed files aren't loading properly.I have a commit here that fixes this, along with a fix for the wrong
populatePathPattern
. Can you tell me if this is an appropriate fix or if I'm missing something here? I can open a PR if the former, as well as write a test case for it.Thanks!
The text was updated successfully, but these errors were encountered: