Just updated local WebHare, but still seems to be a problem.
Insert from TS:
const newAircallCall = await db<WvuawDB>()
.insertInto("wvuaw.aircall_calls")
.values({
started_at: this.convertUnixTimestampToDateTime(
this.webhookData.data.started_at
),
})
.returning(["id"])
.executeTakeFirst();
Database:
+----+--------------------+----------------+
|ID |STARTED_AT |ENDED_AT |
+----+--------------------+----------------+
|1158|2024-05-23T10:12:58Z|DEFAULT DATETIME|
+----+--------------------+----------------+
Query in TS:
const call = await db<WvuawDB>()
.selectFrom("wvuaw.aircall_calls")
.where("callid", "=", String(callId))
.select(["id", "ended_at"])
.executeTakeFirst();
console.log(call);
Result in console.log:
[remote:log] { id: 1158, ended_at: 0000-12-31T00:00:00.000Z }
May have to do with the fact that "ended_at" is not present in the insertInto.values?
Setting ended_at to null explicitly results in:
{"@timestamp":"2024-05-23T10:18:37.462Z","message":"2024-05-23 12:18:37.462 CEST [43684] ERROR: null value in column \"ended_at\" of relation \"aircall_calls\" violates not-null constraint","service":"platform:database","at":391565,"stream":"stdout"}