diff --git a/migration/src/migrate/repository.ts b/migration/src/migrate/repository.ts index 8d9167a31..139a2fb50 100644 --- a/migration/src/migrate/repository.ts +++ b/migration/src/migrate/repository.ts @@ -47,12 +47,7 @@ export default class MigrationRepository { } async insertCourses(courses: CourseEntity[]): Promise { - await this.manager - .createQueryBuilder() - .insert() - .into("courses") - .values(courses) - .execute(); + await this.manager.save(courses, { chunk: 1000 }); } async updateUser(zid: string) { diff --git a/migration/src/migrate/service.ts b/migration/src/migrate/service.ts index 3ed0a68bb..4415e5d67 100644 --- a/migration/src/migrate/service.ts +++ b/migration/src/migrate/service.ts @@ -216,7 +216,7 @@ export default class MigrationService { console.log("Unknown term: ", term); } } - return termNums; + return termNums.filter((term) => !isNaN(term)); }; const entity = new CourseEntity();