"""Ajout état et icône projet

Revision ID: 911c8ecf037d
Revises: 
Create Date: 2025-09-07 15:27:18.748212

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '911c8ecf037d'
down_revision: Union[str, Sequence[str], None] = None
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! ###
    op.alter_column('apilog', 'latency_ms',
               existing_type=sa.REAL(),
               type_=sa.Float(),
               existing_nullable=True,
               existing_server_default=sa.text('0'))
    op.alter_column('apis', 'quota_period',
               existing_type=sa.TEXT(),
               type_=sa.String(),
               existing_nullable=True,
               existing_server_default=sa.text("'hour'"))
    op.add_column('projects', sa.Column('state', sa.String(), nullable=True))
    op.add_column('projects', sa.Column('icon', sa.LargeBinary(), nullable=True))
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('projects', 'icon')
    op.drop_column('projects', 'state')
    op.alter_column('apis', 'quota_period',
               existing_type=sa.String(),
               type_=sa.TEXT(),
               existing_nullable=True,
               existing_server_default=sa.text("'hour'"))
    op.alter_column('apilog', 'latency_ms',
               existing_type=sa.Float(),
               type_=sa.REAL(),
               existing_nullable=True,
               existing_server_default=sa.text('0'))
    # ### end Alembic commands ###
