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