"""add month lifecycle state

Revision ID: a4ec4f8f6e9f
Revises: ec804bdf366d
Create Date: 2026-04-17 12:59:25.811354

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'a4ec4f8f6e9f'
down_revision: Union[str, Sequence[str], None] = 'ec804bdf366d'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('month', schema=None) as batch_op:
        batch_op.add_column(sa.Column('state', sa.Enum('planning', 'active', 'closed', name='monthstate', native_enum=False, length=16), server_default='planning', nullable=False))
        batch_op.add_column(sa.Column('activated_at', sa.DateTime(timezone=True), nullable=True))
        batch_op.add_column(sa.Column('closed_at', sa.DateTime(timezone=True), nullable=True))

    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('month', schema=None) as batch_op:
        batch_op.drop_column('closed_at')
        batch_op.drop_column('activated_at')
        batch_op.drop_column('state')

    # ### end Alembic commands ###
