204000aabc
Resolve 3 merge conflicts and renumber the automation_hooks migration to follow main's migration chain (036_add_document_translation_fields). Conflicts resolved: - app/api/__init__.py: add automation_router alongside main's new routers - app/utils/settings_service.py: add automation_hooks_enabled alongside compliance_enabled - tests/conftest.py: add AutomationHook alongside AuditLog/ComplianceTemplate imports Migration renumbered: - 027_add_automation_hooks → 037_add_automation_hooks - down_revision: 026_add_scheduled_jobs → 036_add_document_translation_fields Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
"""Add mobile_devices table for push notification device registration.
|
|
|
|
Revision ID: 030_add_mobile_devices
|
|
Revises: 029_add_user_language_preference
|
|
Create Date: 2026-03-10
|
|
"""
|
|
|
|
from typing import Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "030_add_mobile_devices"
|
|
down_revision: Union[str, None] = "029_add_user_language_preference"
|
|
depends_on: Union[str, None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Create mobile_devices table."""
|
|
op.create_table(
|
|
"mobile_devices",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("owner_id", sa.String(), nullable=False),
|
|
sa.Column("device_name", sa.String(255), nullable=True),
|
|
sa.Column("platform", sa.String(20), nullable=False, server_default="ios"),
|
|
sa.Column("push_token", sa.String(512), nullable=False),
|
|
sa.Column("is_active", sa.Boolean(), nullable=False, server_default="1"),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
|
sa.Column("last_seen_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("owner_id", "push_token", name="uq_mobile_device_owner_token"),
|
|
)
|
|
op.create_index("ix_mobile_devices_id", "mobile_devices", ["id"])
|
|
op.create_index("ix_mobile_devices_owner_id", "mobile_devices", ["owner_id"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Drop mobile_devices table."""
|
|
op.drop_index("ix_mobile_devices_owner_id", table_name="mobile_devices")
|
|
op.drop_index("ix_mobile_devices_id", table_name="mobile_devices")
|
|
op.drop_table("mobile_devices")
|