typeorm upsert

Solutions on MaxInterview for typeorm upsert by the best coders in the world

showing results for - "typeorm upsert"
Dylan
26 Aug 2020
1await connection.createQueryBuilder()
2        .insert()
3        .into(Post)
4        .values(post2)
5        .onConflict(`("id") DO NOTHING`)
6        .execute();
7
8await connection.createQueryBuilder()
9        .insert()
10        .into(Post)
11        .values(post2)
12        .onConflict(`("id") DO UPDATE SET "title" = :title`)
13        .setParameter("title", post2.title)
14        .execute();