import { getConnection, MigrationInterface, QueryRunner } from "typeorm"; import carModels from '../../constants/carModels' import CarModels from "../../models/CarModels"; export class InsertDataIntoCarModelsTable1653769103891 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { carModels.forEach(async (car) => { const GBP = await queryRunner.manager.save(queryRunner.manager.create(CarModels, { name: car.name })) } )} public async down(queryRunner: QueryRunner): Promise { await getConnection() .createQueryBuilder() .delete() .from(CarModels) .execute(); } }