Guest User

Untitled

a guest
Feb 4th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import { MigrationInterface, QueryRunner, getRepository } from "typeorm";
  2. import { User } from "../entity/User";
  3.  
  4. export class CreateAdminUser1547919837483 implements MigrationInterface {
  5. public async up(queryRunner: QueryRunner): Promise<any> {
  6. let user = new User();
  7. user.username = "admin";
  8. user.password = "admin";
  9. user.hashPassword();
  10. user.role = "ADMIN";
  11. const userRepository = getRepository(User);
  12. await userRepository.save(user);
  13. }
  14.  
  15. public async down(queryRunner: QueryRunner): Promise<any> {}
  16. }
Add Comment
Please, Sign In to add comment