Skip to content

Commit

Permalink
Don't try to delete broadcast URNs which no longer exist
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Feb 15, 2023
1 parent 1c1e81a commit aba51b7
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 aba51b7

Please sign in to comment.