"""add users invite_code

Revision ID: 014_add_user_invite_code
Revises: 013_add_ops_alert_events
Create Date: 2025-12-15
"""

from __future__ import annotations

from alembic import op
import sqlalchemy as sa


revision = "014_add_user_invite_code"
down_revision = "013_add_ops_alert_events"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column("users", sa.Column("invite_code", sa.String(length=32), nullable=True))
    op.create_index("ix_users_invite_code", "users", ["invite_code"], unique=True)


def downgrade() -> None:
    op.drop_index("ix_users_invite_code", table_name="users")
    op.drop_column("users", "invite_code")

