Improve migration script

master
Fernando 2023-05-24 14:36:23 -05:00
parent 7bf1c764aa
commit 51a32c7617
1 changed files with 4 additions and 8 deletions

View File

@ -19,13 +19,10 @@ export class MigratorController {
@Get()
async migrate() {
const registers = await this.registroGIERepository.find({
// @ts-ignore
select: {
cursoGIE: null,
persona: null,
},
});
const registers = await this.registroGIERepository.createQueryBuilder("register")
.where("cursoGIEId IS NULL")
.andWhere("personaId IS NULL")
.getMany();
// Try to create Persons for each user
for (const register of registers) {
@ -138,7 +135,6 @@ export class MigratorController {
</body>
</html>
`;
return `NOT FOUND IN DB NOR SUNAT: ${JSON.stringify(register)}`;
}
}