quick commit
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 6m9s
CI/CD Pipeline / Security Scanning (push) Successful in 26s
CI/CD Pipeline / Tests (3.11) (push) Failing after 5m24s
CI/CD Pipeline / Tests (3.12) (push) Failing after 5m23s
CI/CD Pipeline / Build Docker Image (push) Has been skipped
CI/CD Pipeline / Deploy to Staging (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
CI/CD Pipeline / Notification (push) Successful in 1s
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 6m9s
CI/CD Pipeline / Security Scanning (push) Successful in 26s
CI/CD Pipeline / Tests (3.11) (push) Failing after 5m24s
CI/CD Pipeline / Tests (3.12) (push) Failing after 5m23s
CI/CD Pipeline / Build Docker Image (push) Has been skipped
CI/CD Pipeline / Deploy to Staging (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
CI/CD Pipeline / Notification (push) Successful in 1s
This commit is contained in:
87
migrations/versions/20260117_add_automod_thresholds.py
Normal file
87
migrations/versions/20260117_add_automod_thresholds.py
Normal file
@@ -0,0 +1,87 @@
|
||||
"""Add automod thresholds and scam allowlist.
|
||||
|
||||
Revision ID: 20260117_add_automod_thresholds
|
||||
Revises:
|
||||
Create Date: 2026-01-17 00:00:00.000000
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "20260117_add_automod_thresholds"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column("message_rate_limit", sa.Integer(), nullable=False, server_default="5"),
|
||||
)
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column("message_rate_window", sa.Integer(), nullable=False, server_default="5"),
|
||||
)
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column("duplicate_threshold", sa.Integer(), nullable=False, server_default="3"),
|
||||
)
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column("mention_limit", sa.Integer(), nullable=False, server_default="5"),
|
||||
)
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column("mention_rate_limit", sa.Integer(), nullable=False, server_default="10"),
|
||||
)
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column("mention_rate_window", sa.Integer(), nullable=False, server_default="60"),
|
||||
)
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column(
|
||||
"scam_allowlist",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
nullable=False,
|
||||
server_default=sa.text("'[]'::jsonb"),
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column(
|
||||
"ai_confidence_threshold",
|
||||
sa.Float(),
|
||||
nullable=False,
|
||||
server_default="0.7",
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column("ai_log_only", sa.Boolean(), nullable=False, server_default=sa.text("false")),
|
||||
)
|
||||
|
||||
op.alter_column("guild_settings", "message_rate_limit", server_default=None)
|
||||
op.alter_column("guild_settings", "message_rate_window", server_default=None)
|
||||
op.alter_column("guild_settings", "duplicate_threshold", server_default=None)
|
||||
op.alter_column("guild_settings", "mention_limit", server_default=None)
|
||||
op.alter_column("guild_settings", "mention_rate_limit", server_default=None)
|
||||
op.alter_column("guild_settings", "mention_rate_window", server_default=None)
|
||||
op.alter_column("guild_settings", "scam_allowlist", server_default=None)
|
||||
op.alter_column("guild_settings", "ai_confidence_threshold", server_default=None)
|
||||
op.alter_column("guild_settings", "ai_log_only", server_default=None)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("guild_settings", "ai_log_only")
|
||||
op.drop_column("guild_settings", "ai_confidence_threshold")
|
||||
op.drop_column("guild_settings", "scam_allowlist")
|
||||
op.drop_column("guild_settings", "mention_rate_window")
|
||||
op.drop_column("guild_settings", "mention_rate_limit")
|
||||
op.drop_column("guild_settings", "mention_limit")
|
||||
op.drop_column("guild_settings", "duplicate_threshold")
|
||||
op.drop_column("guild_settings", "message_rate_window")
|
||||
op.drop_column("guild_settings", "message_rate_limit")
|
||||
Reference in New Issue
Block a user