main
py 53 lines 1.6 KB
Raw
1 """Add ioc table for alerts
2
3 Revision ID: 33e4754d845b
4 Revises: a1e4beb87498
5 Create Date: 2024-10-30 15:16:50.509086
6
7 """
8 from typing import Sequence
9 from typing import Union
10
11 import sqlalchemy as sa
12
13 from alembic import op
14
15 # revision identifiers, used by Alembic.
16 revision: str = "33e4754d845b"
17 down_revision: Union[str, None] = "a1e4beb87498"
18 branch_labels: Union[str, Sequence[str], None] = None
19 depends_on: Union[str, Sequence[str], None] = None
20
21
22 def upgrade() -> None:
23 # ### commands auto generated by Alembic - please adjust! ###
24 op.create_table(
25 "incident_management_ioc",
26 sa.Column("id", sa.Integer(), nullable=False),
27 sa.Column("value", sa.String(length=250), nullable=False),
28 sa.Column("type", sa.String(length=50), nullable=False),
29 sa.Column("description", sa.String(length=10000), nullable=True),
30 sa.PrimaryKeyConstraint("id"),
31 )
32 op.create_table(
33 "incident_management_alert_to_ioc",
34 sa.Column("alert_id", sa.Integer(), nullable=False),
35 sa.Column("ioc_id", sa.Integer(), nullable=False),
36 sa.ForeignKeyConstraint(
37 ["alert_id"],
38 ["incident_management_alert.id"],
39 ),
40 sa.ForeignKeyConstraint(
41 ["ioc_id"],
42 ["incident_management_ioc.id"],
43 ),
44 sa.PrimaryKeyConstraint("alert_id", "ioc_id"),
45 )
46 # ### end Alembic commands ###
47
48
49 def downgrade() -> None:
50 # ### commands auto generated by Alembic - please adjust! ###
51 op.drop_table("incident_management_alert_to_ioc")
52 op.drop_table("incident_management_ioc")
53 # ### end Alembic commands ###