Files
2026-03-27 20:59:06 +01:00

36 lines
857 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Migrazione 0012: campi deadline su tabella messages
(Feature 4 Scadenzario e tracking deadlines).
"""
from alembic import op
import sqlalchemy as sa
revision = "0012"
down_revision = "0011"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column(
"messages",
sa.Column("deadline_at", sa.DateTime(timezone=True), nullable=True),
)
op.add_column(
"messages",
sa.Column("deadline_note", sa.Text, nullable=True),
)
op.create_index(
"idx_messages_deadline",
"messages",
["tenant_id", "deadline_at"],
postgresql_where=sa.text("deadline_at IS NOT NULL"),
)
def downgrade() -> None:
op.drop_index("idx_messages_deadline", table_name="messages")
op.drop_column("messages", "deadline_note")
op.drop_column("messages", "deadline_at")