w3tecch / typeorm-seeding

🌱 A delightful way to seed test data into your database.
https://www.npmjs.com/package/typeorm-seeding
MIT License
887 stars 132 forks source link

Running single seed #129

Closed tmtung144 closed 3 years ago

tmtung144 commented 3 years ago

I need to run each seed operation individually, in the terminal when I run seed: run I see an option: --seed, -s Specific seed class to run. but when i run the command: npm run typeorm-seeding seed -s CreateUsers with my seed file 1-create-users.seed.ts like this:

...
export default class CreateUsers implements Seeder {
...
}

It keeps announcing Unknown argument: CreateUsers It works well when it's just running npm run typeorm-seeding seed Looking forward to receiving any useful advice.

AmrAbdalrahman commented 3 years ago

try run ts-node ./node_modules/typeorm-seeding/dist/cli.js seed -s CreateUsers works well

micalevisk commented 3 years ago

@tmtung144 Since you are using npm run ... the -s flag will be passed to npm run command, not to typeorm-seeding seed

Use npm run typeorm-seeding -- seed -s CreateUsers or with Yarn yarn typeorm-seeding seed -s CreateUser

metalcamp commented 3 years ago

Closing, since it seems to be resolved. If you have any further issues regarding this topic please feel free to reopen.