Skip to content

Stop writing Msg.queued_on #728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions backends/rapidpro/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,6 @@ func (ts *BackendTestSuite) TestWriteMsg() {
ts.NotNil(m.NextAttempt_)
ts.NotNil(m.CreatedOn_)
ts.NotNil(m.ModifiedOn_)
ts.NotNil(m.QueuedOn_)

contact, err := contactForURN(ctx, ts.b, m.OrgID_, knChannel, urn, nil, "", clog)
ts.NoError(err)
Expand Down Expand Up @@ -1532,7 +1531,6 @@ SELECT
created_on,
modified_on,
next_attempt,
queued_on,
sent_on,
log_uuids
FROM
Expand Down
6 changes: 2 additions & 4 deletions backends/rapidpro/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ type Msg struct {
NextAttempt_ time.Time ` db:"next_attempt"`
CreatedOn_ time.Time `json:"created_on" db:"created_on"`
ModifiedOn_ time.Time ` db:"modified_on"`
QueuedOn_ time.Time ` db:"queued_on"`
SentOn_ *time.Time ` db:"sent_on"`
LogUUIDs pq.StringArray ` db:"log_uuids"`

Expand Down Expand Up @@ -125,7 +124,6 @@ func newMsg(direction MsgDirection, channel courier.Channel, urn urns.URN, text
NextAttempt_: now,
CreatedOn_: now,
ModifiedOn_: now,
QueuedOn_: now,
LogUUIDs: []string{string(clog.UUID())},

channel: dbChannel,
Expand Down Expand Up @@ -247,9 +245,9 @@ func writeMsg(ctx context.Context, b *backend, msg courier.MsgIn, clog *courier.
const sqlInsertMsg = `
INSERT INTO
msgs_msg(org_id, uuid, direction, text, attachments, msg_type, msg_count, error_count, high_priority, status,
visibility, external_id, channel_id, contact_id, contact_urn_id, created_on, modified_on, next_attempt, queued_on, sent_on, log_uuids)
visibility, external_id, channel_id, contact_id, contact_urn_id, created_on, modified_on, next_attempt, sent_on, log_uuids)
VALUES(:org_id, :uuid, :direction, :text, :attachments, 'T', :msg_count, :error_count, :high_priority, :status,
:visibility, :external_id, :channel_id, :contact_id, :contact_urn_id, :created_on, :modified_on, :next_attempt, :queued_on, :sent_on, :log_uuids)
:visibility, :external_id, :channel_id, :contact_id, :contact_urn_id, :created_on, :modified_on, :next_attempt, :sent_on, :log_uuids)
RETURNING id`

func writeMsgToDB(ctx context.Context, b *backend, m *Msg, clog *courier.ChannelLog) error {
Expand Down
1 change: 0 additions & 1 deletion backends/rapidpro/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ CREATE TABLE msgs_msg (
created_on timestamp with time zone NOT NULL,
modified_on timestamp with time zone,
sent_on timestamp with time zone,
queued_on timestamp with time zone,
direction character varying(1) NOT NULL,
status character varying(1) NOT NULL,
visibility character varying(1) NOT NULL,
Expand Down
12 changes: 6 additions & 6 deletions backends/rapidpro/testdata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ INSERT INTO msgs_optin(id, uuid, org_id, name) VALUES

/** Msg with id 10000 */
DELETE FROM msgs_msg;
INSERT INTO msgs_msg("id", "text", "high_priority", "created_on", "modified_on", "sent_on", "queued_on", "direction", "status", "visibility", "msg_type",
INSERT INTO msgs_msg("id", "text", "high_priority", "created_on", "modified_on", "sent_on", "direction", "status", "visibility", "msg_type",
"msg_count", "error_count", "next_attempt", "external_id", "channel_id", "contact_id", "contact_urn_id", "org_id")
VALUES(10000, 'test message', True, now(), now(), now(), now(), 'O', 'W', 'V', 'T',
VALUES(10000, 'test message', True, now(), now(), now(), 'O', 'W', 'V', 'T',
1, 0, now(), 'ext1', 10, 100, 1000, 1);

INSERT INTO msgs_msg("id", "text", "high_priority", "created_on", "modified_on", "sent_on", "queued_on", "direction", "status", "visibility", "msg_type",
INSERT INTO msgs_msg("id", "text", "high_priority", "created_on", "modified_on", "sent_on", "direction", "status", "visibility", "msg_type",
"msg_count", "error_count", "next_attempt", "external_id", "channel_id", "contact_id", "contact_urn_id", "org_id")
VALUES(10001, 'test message without external', True, now(), now(), now(), now(), 'O', 'W', 'V', 'T',
VALUES(10001, 'test message without external', True, now(), now(), now(), 'O', 'W', 'V', 'T',
1, 0, now(), '', 10, 100, 1000, 1);

INSERT INTO msgs_msg("id", "text", "high_priority", "created_on", "modified_on", "sent_on", "queued_on", "direction", "status", "visibility", "msg_type",
INSERT INTO msgs_msg("id", "text", "high_priority", "created_on", "modified_on", "sent_on", "direction", "status", "visibility", "msg_type",
"msg_count", "error_count", "next_attempt", "external_id", "channel_id", "contact_id", "contact_urn_id", "org_id")
VALUES(10002, 'test message incoming', True, now(), now(), now(), now(), 'I', 'P', 'V', 'T',
VALUES(10002, 'test message incoming', True, now(), now(), now(), 'I', 'P', 'V', 'T',
1, 0, now(), 'ext2', 10, 100, 1000, 1);

INSERT INTO msgs_media("id", "uuid", "org_id", "content_type", "url", "path", "size", "duration", "width", "height", "original_id")
Expand Down
Loading