Off-viewport clients that send {type:watch_geofences,ids} on /ws/live
still receive geofence_alert; AIS/ADS-B stay viewport-only.
GET /api/geofence-alerts accepts geofence_id/since/until/source_kind.
GET /api/geofences/{id}/at returns CAGG+FIRMS inside the fence at T
(404 if missing, empty lists if DB down). DELETE missing fences 404s.
24 lines
578 B
Python
24 lines
578 B
Python
"""geofence_alerts (geofence_id, created_at DESC) for fence-scoped hit log
|
|
|
|
Revision ID: 011_geofence_alerts_fence
|
|
Revises: 010_bbox_gist
|
|
Create Date: 2026-09-01
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
revision = "011_geofence_alerts_fence"
|
|
down_revision = "010_bbox_gist"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute(
|
|
"CREATE INDEX IF NOT EXISTS ix_geofence_alerts_fence_created "
|
|
"ON geofence_alerts (geofence_id, created_at DESC)"
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute("DROP INDEX IF EXISTS ix_geofence_alerts_fence_created")
|