static async upsert(idPerson: number, studyType: StudyType) {
const idStudyTypeSql = sql`(select id_study_type from study_type where study_type = ${studyType})`;
await db
.insert(student)
.values({
idPerson,
idStudyType: idStudyTypeSql,
})
.onConflictDoUpdate({
target: student.idPerson,
set: {
idStudyType: idStudyTypeSql,
},
});
}
static async upsert(idPerson: number, studyType: StudyType) {
const idStudyTypeSql = sql`(select id_study_type from study_type where study_type = ${studyType})`;
await db
.insert(student)
.values({
idPerson,
idStudyType: idStudyTypeSql,
})
.onConflictDoUpdate({
target: student.idPerson,
set: {
idStudyType: idStudyTypeSql,
},
});
}