"""Mail salt security fix — add password_salt column to mail_accounts.

Revision ID: 0026
Revises: 0025_entity_history
Create Date: 2026-07-23

Existing accounts get an empty salt and will use the legacy hardcoded salt
for backward compatibility. New accounts and password changes will use
per-account random salts.
"""
from alembic import op
import sqlalchemy as sa


revision = "0026_mail_salt_security"
down_revision = "0025_entity_history"


def upgrade():
    op.add_column("mail_accounts", sa.Column("password_salt", sa.String(64), nullable=False, server_default=""))


def downgrade():
    op.drop_column("mail_accounts", "password_salt")
