4167687dec
Store last notify time by dedup_key/fingerprint, gate dispatch before channels; config SAC_NOTIFY_*_COOLDOWN_SEC, migration 008. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
945 B
Python
32 lines
945 B
Python
"""notification_cooldown for SAC notify dedup (F-NOT-03)
|
|
|
|
Revision ID: 008
|
|
Revises: 007
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "008"
|
|
down_revision: Union[str, None] = "007"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"notification_cooldown",
|
|
sa.Column("cooldown_key", sa.String(length=512), nullable=False),
|
|
sa.Column("kind", sa.String(length=16), nullable=False),
|
|
sa.Column("last_notified_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.PrimaryKeyConstraint("cooldown_key"),
|
|
)
|
|
op.create_index("ix_notification_cooldown_kind", "notification_cooldown", ["kind"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_notification_cooldown_kind", table_name="notification_cooldown")
|
|
op.drop_table("notification_cooldown")
|