Is there a way to run typeorm query builder without it loading the entity?

Viewed 2706

I have noticed that typeorm loads the specified entity when running query builder.

For example, if I run the following inside a migration.

await queryRunner.manager
      .createQueryBuilder()
      .insert()
      .into('users')
      .values({
        name: 'Testing',
        language: 'english',
      })
      .execute();

After this if I modify user table and add a new column (let's say email), also using a migration. Now if I wipe my database and re run the migrations, typeorm will complain no column named email found in User. I guess it loads the User entity when running query builder, is there a way to tell typeorm not to load the entity and just create the sql query based on what is provided in query builder.

0 Answers
Related