fix: seeder

This commit is contained in:
ilham 2022-01-26 22:24:10 +07:00
parent c301af2d8d
commit 85d8bcd3ec

View File

@ -1,17 +1,31 @@
import { Factory, Seeder } from 'typeorm-seeding' import { Factory, Seeder } from 'typeorm-seeding';
import { Connection } from 'typeorm' import { Connection } from 'typeorm';
import { Roles } from '../configurable/entities/roles.entity' import { Roles } from '../configurable/entities/roles.entity';
export default class CreateUsers implements Seeder { export default class CreateUsers implements Seeder {
public async run(factory: Factory, connection: Connection): Promise<any> { public async run(factory: Factory, connection: Connection): Promise<any> {
await connection await connection
.createQueryBuilder() .createQueryBuilder()
.insert() .insert()
.into(Roles) .into('roles')
.values([ .values([
{ id: '3196cdf4-ae5f-4677-9bcd-98be35c72321', name: 'Admin' }, {
{ id: '3196cdf4-ae5f-4677-9bcd-98be35c72322', name: 'Supervisor' }, id: '3196cdf4-ae5f-4677-9bcd-98be35c72329',
created_at: new Date(),
updated_at: new Date(),
deleted_at: null,
version: 1,
name: 'Admin',
},
{
id: '3196cdf4-ae5f-4677-9bcd-98be35c72328',
created_at: new Date(),
updated_at: new Date(),
deleted_at: null,
version: 1,
name: 'Supervisor',
},
]) ])
.execute() .execute();
} }
} }