(connection: Connection)
| 2 | import { RedisService } from '@apitable/nestjs-redis'; |
| 3 | |
| 4 | export const clearDatabase = async(connection: Connection) => { |
| 5 | const entities = connection.entityMetadatas; |
| 6 | |
| 7 | for (const entity of entities) { |
| 8 | console.log(entity.tableName); |
| 9 | const repository = connection.getRepository(entity.name); |
| 10 | await repository.query(`DELETE FROM ${entity.tableName};`); |
| 11 | } |
| 12 | }; |
| 13 | |
| 14 | export const clearRedis = async(redisService: RedisService) => { |
| 15 | const redis = redisService.getClient(); |
no test coverage detected