Sitelet https://web.archive.org/web/20200905030012/https://github.com/knex/knex/issues/3678
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

[Feature Request] Support running multiple specific seed files #3678

Open
thgaskell opened this issue Feb 21, 2020 · 0 comments
Open

[Feature Request] Support running multiple specific seed files #3678

thgaskell opened this issue Feb 21, 2020 · 0 comments

Comments

@thgaskell
Copy link

@thgaskell thgaskell commented Feb 21, 2020 •

Feature discussion / request

Currently, it's not possible to control the execution order of seed files even when the --specific flag is used. Users are required to execute multiple separate commands which is error prone, and doesn't make use of the underlying _waterfallBatch method.

It would be nice to be able to explicitly define which seeds you'd like to run (as well as the execution order).

Use cases

Background: 
  Given the seed file "seed-filename-1.js" exists
    And the seed file "seed-filename-2.js" exists
    And the seed file "seed-filename-3.js" exists

Scenario: A developer wants to run multiple specific seed files
  When the developer runs the command:
    """
    knex seed:run \
      --specific seed-filename-1.js \
      --specific seed-filename-2.js
    """
  Then "seed-filename-1.js" should run first
   And "seed-filename-2.js" should run second
   But "seed-filename-3.js" should not run

Scenario: A developer wants to run multiple seed files in a specific order
  When the developer runs the command:
    """
    knex seed:run \
      --specific seed-filename-3.js \
      --specific seed-filename-2.js \
      --specific seed-filename-1.js
    """
  Then "seed-filename-3.js" should run first
   And "seed-filename-2.js" should run second
   And "seed-filename-1.js" should run third

Scenario: A developer wants to run multiple seed files programatically
  When the developer executes:
    """
    knex.seed.run({ specific: ['seed-filename-3.js', 'seed-filename-1.js'] });
    """
  Then "seed-filename-3.js" should run first
   And "seed-filename-1.js" should run second
   But "seed-filename-2.js" should not run

Proposed changes

Since commander supports parsing multiple values, that could be passed to the underlying Seeder calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.