@@ -14,6 +14,7 @@ import (
14
14
"github.com/lib/pq"
15
15
"github.com/nyaruka/courier"
16
16
"github.com/nyaruka/gocommon/urns"
17
+ "github.com/nyaruka/gocommon/uuids"
17
18
"github.com/nyaruka/null/v3"
18
19
)
19
20
@@ -65,6 +66,7 @@ func newChannelEvent(channel courier.Channel, eventType courier.ChannelEventType
65
66
dbChannel := channel .(* Channel )
66
67
67
68
return & ChannelEvent {
69
+ UUID_ : courier .ChannelEventUUID (uuids .NewV4 ()),
68
70
ChannelUUID_ : dbChannel .UUID_ ,
69
71
OrgID_ : dbChannel .OrgID_ ,
70
72
ChannelID_ : dbChannel .ID_ ,
@@ -136,8 +138,8 @@ func writeChannelEvent(ctx context.Context, b *backend, event courier.ChannelEve
136
138
137
139
const sqlInsertChannelEvent = `
138
140
INSERT INTO
139
- channels_channelevent( org_id, channel_id, contact_id, contact_urn_id, event_type, optin_id, extra, occurred_on, created_on, status, log_uuids)
140
- VALUES(:org_id, :channel_id, :contact_id, :contact_urn_id, :event_type, :optin_id, :extra, :occurred_on, NOW(), 'P', :log_uuids)
141
+ channels_channelevent( org_id, uuid, channel_id, contact_id, contact_urn_id, event_type, optin_id, extra, occurred_on, created_on, status, log_uuids)
142
+ VALUES(:org_id, :uuid, : channel_id, :contact_id, :contact_urn_id, :event_type, :optin_id, :extra, :occurred_on, NOW(), 'P', :log_uuids)
141
143
RETURNING id, created_on`
142
144
143
145
// writeChannelEventToDB writes the passed in channel event to our db
0 commit comments