1a195a96bd
- Merge origin/main into branch (resolve conflict in integrations_dashboard.html) - Add defensive JSON parsing with try/except for integration.config - Wrap tester() call in try/except to prevent 500 errors from bad config - Add i18n key integrations.connection_test_failed_fallback in en.json - Reference i18n key in template JS fallback message - Update SECURITY_AUDIT.md: add fix date (2026-03-23), update doc date - Remove accidental revert.sh file - Fix missing MagicMock/patch imports in test file - Add tests for invalid JSON config and tester exception error paths Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/daebb70e-059a-4601-8864-88eef49f99cf
47 lines
2.0 KiB
Python
47 lines
2.0 KiB
Python
"""Add classification_rules table for custom document classification rules.
|
|
|
|
Revision ID: 039_add_classification_rules
|
|
Revises: 038_add_api_token_expires_at
|
|
Create Date: 2026-03-17
|
|
"""
|
|
|
|
from typing import Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "039_add_classification_rules"
|
|
down_revision: Union[str, None] = "038_add_api_token_expires_at"
|
|
depends_on: Union[str, None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Create classification_rules table."""
|
|
op.create_table(
|
|
"classification_rules",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("owner_id", sa.String(), nullable=True),
|
|
sa.Column("name", sa.String(255), nullable=False),
|
|
sa.Column("category", sa.String(100), nullable=False),
|
|
sa.Column("rule_type", sa.String(50), nullable=False),
|
|
sa.Column("pattern", sa.String(1000), nullable=False),
|
|
sa.Column("priority", sa.Integer(), nullable=False, server_default="0"),
|
|
sa.Column("case_sensitive", sa.Boolean(), nullable=False, server_default="0"),
|
|
sa.Column("enabled", sa.Boolean(), nullable=False, server_default="1"),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("owner_id", "name", name="uq_classification_rules_owner_name"),
|
|
)
|
|
op.create_index("ix_classification_rules_id", "classification_rules", ["id"])
|
|
op.create_index("ix_classification_rules_owner_id", "classification_rules", ["owner_id"])
|
|
op.create_index("ix_classification_rules_category", "classification_rules", ["category"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Drop classification_rules table."""
|
|
op.drop_index("ix_classification_rules_category", "classification_rules")
|
|
op.drop_index("ix_classification_rules_owner_id", "classification_rules")
|
|
op.drop_index("ix_classification_rules_id", "classification_rules")
|
|
op.drop_table("classification_rules")
|