I am using the query builder to run the following query.
However, when I print the query, it seems like the 2nd parameter is being passed instead of the 1st parameter. Can someone explain what I might be doing wrong here?
const queryRunner: QueryRunner = getConnection().createQueryRunner();
await queryRunner.startTransaction();
try {
//other queries here deleted for simplicity
await queryRunner.manager
.getRepository(User)
.createQueryBuilder()
.update(User)
.set({ status: UserStatus.INACTIVE }) // UserStatus is enum
.where("organizationId IN(:...ids)", { ids: organizations })
.printSql()
.execute();
await queryRunner.commitTransaction();
} catch (err) {
await queryRunner.rollbackTransaction();
console.log("=====Rollback=====");
} finally {
await queryRunner.release();
}
This is the output:
UPDATE "users" SET "status" = $2 WHERE "organizationId" IN($2, $3, $4, $5) -- PARAMETERS: ["INACTIVE",32,36,35,34]