Skip to content

Commit

Permalink
Merge pull request #81 from nyaruka/no_more_bcast_urns
Browse files Browse the repository at this point in the history
Don't try to delete broadcast URNs which no longer exist
  • Loading branch information
rowanseymour authored Feb 15, 2023
2 parents 1c1e81a + aba51b7 commit 417e9aa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
7 changes: 0 additions & 7 deletions archives/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,6 @@ func DeleteBroadcasts(ctx context.Context, now time.Time, config *Config, db *sq
return errors.Wrapf(err, "error deleting related groups for broadcast: %d", broadcastID)
}

// delete URNs M2M
_, err = tx.Exec(`DELETE from msgs_broadcast_urns WHERE broadcast_id = $1`, broadcastID)
if err != nil {
tx.Rollback()
return errors.Wrapf(err, "error deleting related urns for broadcast: %d", broadcastID)
}

// delete counts associated with this broadcast
_, err = tx.Exec(`DELETE from msgs_broadcastmsgcount WHERE broadcast_id = $1`, broadcastID)
if err != nil {
Expand Down
7 changes: 0 additions & 7 deletions testdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ DROP TABLE IF EXISTS flows_flowrun CASCADE;
DROP TABLE IF EXISTS flows_flow CASCADE;
DROP TABLE IF EXISTS msgs_broadcast_contacts CASCADE;
DROP TABLE IF EXISTS msgs_broadcast_groups CASCADE;
DROP TABLE IF EXISTS msgs_broadcast_urns CASCADE;
DROP TABLE IF EXISTS msgs_broadcastmsgcount CASCADE;
DROP TABLE IF EXISTS msgs_broadcast CASCADE;
DROP TABLE IF EXISTS msgs_label CASCADE;
Expand Down Expand Up @@ -134,12 +133,6 @@ CREATE TABLE msgs_broadcast_groups (
contactgroup_id integer NOT NULL REFERENCES contacts_contactgroup(id)
);

CREATE TABLE msgs_broadcast_urns (
id serial primary key,
broadcast_id integer NOT NULL REFERENCES msgs_broadcast(id),
contacturn_id integer NOT NULL REFERENCES contacts_contacturn(id)
);

CREATE TABLE msgs_broadcastmsgcount (
id serial primary key,
count integer NOT NULL,
Expand Down

0 comments on commit 417e9aa

Please sign in to comment.