Add whatsapp feature
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
"""Add notification_settings column to tenant_settings table
|
||||
|
||||
Revision ID: 002_add_notification_settings
|
||||
Revises: 001_unified_initial_schema
|
||||
Create Date: 2025-11-13 15:00:00.000000+00:00
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '002_add_notification_settings'
|
||||
down_revision: Union[str, None] = '001_unified_initial_schema'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Add notification_settings column with default values"""
|
||||
|
||||
# Add column with default value as JSONB
|
||||
op.add_column(
|
||||
'tenant_settings',
|
||||
sa.Column(
|
||||
'notification_settings',
|
||||
postgresql.JSON(astext_type=sa.Text()),
|
||||
nullable=False,
|
||||
server_default=sa.text("""'{
|
||||
"whatsapp_enabled": false,
|
||||
"whatsapp_phone_number_id": "",
|
||||
"whatsapp_access_token": "",
|
||||
"whatsapp_business_account_id": "",
|
||||
"whatsapp_api_version": "v18.0",
|
||||
"whatsapp_default_language": "es",
|
||||
"email_enabled": true,
|
||||
"email_from_address": "",
|
||||
"email_from_name": "",
|
||||
"email_reply_to": "",
|
||||
"enable_po_notifications": true,
|
||||
"enable_inventory_alerts": true,
|
||||
"enable_production_alerts": true,
|
||||
"enable_forecast_alerts": true,
|
||||
"po_notification_channels": ["email"],
|
||||
"inventory_alert_channels": ["email"],
|
||||
"production_alert_channels": ["email"],
|
||||
"forecast_alert_channels": ["email"]
|
||||
}'::jsonb""")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Remove notification_settings column"""
|
||||
op.drop_column('tenant_settings', 'notification_settings')
|
||||
Reference in New Issue
Block a user