Skip to content

Commit

Permalink
feat(seeds): new environment config
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz committed Jun 23, 2022
1 parent 454f5cf commit c2db882
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions adonis-typings/seeder.ts
Expand Up @@ -15,6 +15,7 @@ declare module '@ioc:Adonis/Lucid/Seeder' {
*/
export type SeederConstructorContract = {
developmentOnly: boolean
environment: string[]
new (client: QueryClientContract): {
client: QueryClientContract
run(): Promise<void>
Expand Down
5 changes: 2 additions & 3 deletions src/SeedsRunner/index.ts
Expand Up @@ -58,10 +58,9 @@ export class SeedsRunner {
}

/**
* Ignore when running in non-development environment and seeder is development
* only
* Ignore when when the node environement is not the same as the seeder configuration.
*/
if (Source.developmentOnly && !this.app.inDev) {
if (Source.developmentOnly && !this.app.inDev || Source.environment && !Source.environment.includes(this.app.nodeEnvironment)) {
seeder.status = 'ignored'
return seeder
}
Expand Down

0 comments on commit c2db882

Please sign in to comment.