fix: seeder
This commit is contained in:
parent
c301af2d8d
commit
85d8bcd3ec
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user