"""Add referral_code to users

Revision ID: ab0d186d8497
Revises: add_contact_snapshots
Create Date: 2026-01-07 16:13:43.856177

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ab0d186d8497'
down_revision = 'add_contact_snapshots'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('users', schema=None) as batch_op:
        batch_op.add_column(sa.Column('referral_code', sa.String(length=12), nullable=True))
        batch_op.create_index(batch_op.f('ix_users_referral_code'), ['referral_code'], unique=False)

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('users', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_users_referral_code'))
        batch_op.drop_column('referral_code')

    # ### end Alembic commands ###
