Skip to content

populateDb expects seed files that export a function, but knex seed files exports.seed #61

@calvinl

Description

@calvinl

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:

exports.seed = async function() {
  // ..seed data here
}

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions