61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
"""drop terminal observation event table
|
|
|
|
Revision ID: c6d7e8f90123
|
|
Revises: b4c5d6e7f809
|
|
Create Date: 2026-03-19 18:20:00.000000
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "c6d7e8f90123"
|
|
down_revision = "b4c5d6e7f809"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.drop_table("terminal_observation_event")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.create_table(
|
|
"terminal_observation_event",
|
|
sa.Column("id", sa.Uuid(), nullable=False),
|
|
sa.Column("raw_id", sa.Uuid(), nullable=False),
|
|
sa.Column("device_id", sa.String(length=255), nullable=False),
|
|
sa.Column("event_time", sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column("event_type", sa.String(length=64), nullable=False),
|
|
sa.Column("payload_json", sa.JSON(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.ForeignKeyConstraint(["raw_id"], ["terminal_message_raw.id"]),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_terminal_observation_event_device_id"),
|
|
"terminal_observation_event",
|
|
["device_id"],
|
|
unique=False,
|
|
)
|
|
op.create_index(
|
|
op.f("ix_terminal_observation_event_event_time"),
|
|
"terminal_observation_event",
|
|
["event_time"],
|
|
unique=False,
|
|
)
|
|
op.create_index(
|
|
op.f("ix_terminal_observation_event_event_type"),
|
|
"terminal_observation_event",
|
|
["event_type"],
|
|
unique=False,
|
|
)
|
|
op.create_index(
|
|
op.f("ix_terminal_observation_event_raw_id"),
|
|
"terminal_observation_event",
|
|
["raw_id"],
|
|
unique=False,
|
|
)
|