Fix incorrect reference to the breadcrumb event, as this was being overridden by the referring event ID.

Sam Black 6 years ago
parent e435a65051
commit fd91a17e95
Signed by: samwwwblack
GPG Key ID: 0FF0223994EA47D8

@ -332,7 +332,7 @@ def record_data(project_id, data, sentry_client):
bc_event = Event.query.filter_by(
if bc_event:
bc_data["event_id"] =
bc_data["related_event_id"] =
# This sleep shouldn't matter

@ -165,8 +165,14 @@ class Breadcrumb(db.Model):
data = db.Column(JSONType())
message = db.Column(db.Text())
# `event_id` isn't listed in the documentation as existing,
# but clients do send it.
# Clients send an "event_id" not in the documentation,
# which refers to the bread crumb event.
# We need both the breadcrumb event ID and
# the event ID of the the reporting event.
related_event_id = db.Column(db.Integer(), db.ForeignKey(""))
related_event = db.relationship("Event", foreign_keys=[related_event_id])
# Associate the breadcrumb with this event
event_id = db.Column(db.Integer(), db.ForeignKey(""))
@ -238,6 +244,7 @@ class Event(db.Model):
sql_query = db.Column(JSONType())
# Breadcrumbs
breadcrumbs = db.relationship("Breadcrumb", cascade="all, delete",
backref=db.backref("event", uselist=False))
# These are all listed as deprecated in the source code,

@ -0,0 +1,27 @@
"""Link to the related event ID,
rather than allow the referring event to override it.
Revision ID: 0b5f2e6b1861
Revises: 1ec0718b81d5
Create Date: 2017-11-11 18:21:17.931612
# revision identifiers, used by Alembic.
revision = '0b5f2e6b1861'
down_revision = '1ec0718b81d5'
from alembic import op
import sqlalchemy as sa
def upgrade():
sa.Column('related_event_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'breadcrumb', 'event', ['related_event_id'],
def downgrade():
op.drop_constraint(None, 'breadcrumb', type_='foreignkey')
op.drop_column('breadcrumb', 'related_event_id')