Files
gh-christianlouis-docuelevate/migrations/versions/040_add_automation_hooks.py
T
copilot-swe-agent[bot] 11a49eb7fd fix(migrations): restore accidentally deleted migration files 038-042
Migration files 038-042 were accidentally deleted by commit d2217531
("Sentinel: Fix SSRF in IMAP connections"), which broke container
startup because existing databases had alembic_version stamped to
042_add_file_shares — a revision Alembic could no longer find.

Restored from the parent of that commit:
- 038_add_api_token_expires_at.py
- 039_add_classification_rules.py
- 040_add_automation_hooks.py
- 041_add_document_comments_and_annotations.py
- 042_add_file_shares.py

Alembic now resolves a clean single-head chain (001→042).

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/f6165a49-2ec0-4158-9f1f-d508bb0489fe
2026-03-23 23:36:45 +00:00

40 lines
1.4 KiB
Python

"""Add automation_hooks table for Zapier / Make.com webhook subscriptions.
Revision ID: 040_add_automation_hooks
Revises: 039_add_classification_rules
Create Date: 2026-03-09
"""
from typing import Union
import sqlalchemy as sa
from alembic import op
revision: str = "040_add_automation_hooks"
down_revision: Union[str, None] = "039_add_classification_rules"
depends_on: Union[str, None] = None
def upgrade() -> None:
"""Create automation_hooks table."""
op.create_table(
"automation_hooks",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("target_url", sa.String(), nullable=False),
sa.Column("secret", sa.String(), nullable=True),
sa.Column("events", sa.Text(), nullable=False),
sa.Column("is_active", sa.Boolean(), nullable=False, server_default="1"),
sa.Column("hook_type", sa.String(50), nullable=False, server_default="generic"),
sa.Column("description", sa.String(), nullable=True),
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"),
)
op.create_index("ix_automation_hooks_id", "automation_hooks", ["id"])
def downgrade() -> None:
"""Drop automation_hooks table."""
op.drop_index("ix_automation_hooks_id", "automation_hooks")
op.drop_table("automation_hooks")