Skip to content

Commit

Permalink
Removes signal instance fingerprint column (#4047)
Browse files Browse the repository at this point in the history
* Removes unused fingerprint column from signal instance model

* revision

* more instances
  • Loading branch information
mvilanova authored Nov 30, 2023
1 parent d1da008 commit c117912
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/dispatch/case/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,11 @@ class SignalRead(DispatchBase):


class SignalInstanceRead(DispatchBase):
signal: SignalRead
created_at: datetime
entities: Optional[List[EntityRead]] = []
tags: Optional[List[TagRead]] = []
raw: Any
fingerprint: Optional[str]
created_at: datetime
signal: SignalRead
tags: Optional[List[TagRead]] = []


class ProjectRead(DispatchBase):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Removes unused fingerprint column from signal instance model
Revision ID: 580a18ec4c39
Revises: bdaeabba3e53
Create Date: 2023-11-29 15:40:12.524085
"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = "580a18ec4c39"
down_revision = "bdaeabba3e53"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("signal_instance", "fingerprint")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"signal_instance",
sa.Column("fingerprint", sa.VARCHAR(), autoincrement=False, nullable=True),
)
# ### end Alembic commands ###
2 changes: 0 additions & 2 deletions src/dispatch/signal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ class SignalInstance(Base, TimeStampMixin, ProjectMixin):
case_type = relationship("CaseType", backref="signal_instances")
case_priority_id = Column(Integer, ForeignKey(CasePriority.id))
case_priority = relationship("CasePriority", backref="signal_instances")
fingerprint = Column(String)
filter_action = Column(String)
canary = Column(Boolean, default=False)
raw = Column(JSONB)
Expand Down Expand Up @@ -381,7 +380,6 @@ class SignalInstanceCreate(SignalInstanceBase):

class SignalInstanceRead(SignalInstanceBase):
id: uuid.UUID
fingerprint: Optional[str]
signal: SignalRead


Expand Down
1 change: 0 additions & 1 deletion tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@ class SignalInstanceFactory(BaseFactory):
id = LazyFunction(uuid.uuid4)
project = SubFactory(ProjectFactory)
case = SubFactory(CaseFactory)
fingerprint = fake.md5()
signal = SubFactory(SignalFactory)
raw = {
"action": [{"type": "AWS_API_CALL", "value": {"Api": "assumerole", "ServiceName": "sts"}}],
Expand Down

0 comments on commit c117912

Please sign in to comment.