fix: seeder
This commit is contained in:
@@ -48,6 +48,8 @@ import { MulterModule } from '@nestjs/platform-express';
|
||||
synchronize: true,
|
||||
autoLoadEntities: true,
|
||||
logging: true,
|
||||
seeds: ['src/seeds/**/*{.ts,.js}'],
|
||||
factories: ['src/factories/**/*{.ts,.js}'],
|
||||
namingStrategy: new SnakeNamingStrategy(),
|
||||
};
|
||||
},
|
||||
|
||||
17
src/seeder/roles.ts
Normal file
17
src/seeder/roles.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Factory, Seeder } from 'typeorm-seeding'
|
||||
import { Connection } from 'typeorm'
|
||||
import { Roles } from '../configurable/entities/roles.entity'
|
||||
|
||||
export default class CreateUsers implements Seeder {
|
||||
public async run(factory: Factory, connection: Connection): Promise<any> {
|
||||
await connection
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(Roles)
|
||||
.values([
|
||||
{ id: '3196cdf4-ae5f-4677-9bcd-98be35c72321', name: 'Admin' },
|
||||
{ id: '3196cdf4-ae5f-4677-9bcd-98be35c72322', name: 'Supervisor' },
|
||||
])
|
||||
.execute()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user