Skip to content

Commit 3010b8e

Browse files
committed
#45 Fix invalid upsert syntax
1 parent 0c9a435 commit 3010b8e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/people/src/main/kotlin/ru/ifmo/se/dating/people/storage/jooq/JooqPersonStorage.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ class JooqPersonStorage(private val database: JooqDatabase) : PersonStorage {
2121
database.only {
2222
val record = draft.toRecord()
2323
insertInto(PERSON)
24-
.values(record)
24+
.set(PERSON.ACCOUNT_ID, draft.id.number)
25+
.also { q -> draft.firstName?.text?.let { q.set(PERSON.FIRST_NAME, it) } }
26+
.also { q -> draft.lastName?.text?.let { q.set(PERSON.LAST_NAME, it) } }
27+
.also { q -> draft.height?.let { q.set(PERSON.HEIGHT, it) } }
28+
.also { q -> draft.birthday?.let { q.set(PERSON.BIRTHDAY, it) } }
29+
.also { q -> draft.facultyId?.number?.let { q.set(PERSON.FACULTY_ID, it) } }
30+
.also { q -> draft.locationId?.number?.let { q.set(PERSON.FACULTY_ID, it) } }
2531
.onConflict(PERSON.ACCOUNT_ID)
2632
.doUpdate()
2733
.set(record)

0 commit comments

Comments
 (0)