Skip to content
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

Don't try to delete broadcast URNs which no longer exist #81

Merged
merged 1 commit into from
Feb 15, 2023
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
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