Skip to content

Commit

Permalink
feat: default user insert
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzowind committed Jul 30, 2021
1 parent fa0cdfa commit b5af4cb
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export default class InsertUserAdminDefault1627673531443
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.manager
.createQueryBuilder()
.insert()
.into('users')
.values([
{
id: 'DU-01',
name: 'admin',
login: 'admin',
email: 'admin@email.com',
password:
'$2a$08$Vyz9LSeC05LtAajTc69X0uHueyff6Uu6VAyQreEGiTY3wOgpGiNRa',
position: 'Administrador',
created_at: new Date(),
updated_at: new Date(),
},
])
.execute();
}

public async down(queryRunner: QueryRunner): Promise<any> {
queryRunner.manager
.createQueryBuilder()
.delete()
.from('users')
.where('id = :id', { id: 'DU-01' })
.execute();
}
}

0 comments on commit b5af4cb

Please sign in to comment.