From e7f909f96815bcfb0c1dba664d49ef0931493cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Engstr=C3=B6m?= Date: Mon, 15 Apr 2019 11:26:36 +0200 Subject: [PATCH] Make migration only use provided QueryRunner Make sure all actions in the migration is part of the transaction. --- src/migration/1549202832774-CreateAdminUser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/migration/1549202832774-CreateAdminUser.ts b/src/migration/1549202832774-CreateAdminUser.ts index d6092b7..61d3974 100644 --- a/src/migration/1549202832774-CreateAdminUser.ts +++ b/src/migration/1549202832774-CreateAdminUser.ts @@ -8,7 +8,7 @@ export class CreateAdminUser1547919837483 implements MigrationInterface { user.password = "admin"; user.hashPassword(); user.role = "ADMIN"; - const userRepository = getRepository(User); + const userRepository = queryRunner.manager.getRepository(User); await userRepository.save(user); }