"""auto

Revision ID: 373571dfe134
Revises: 0fcf1e150ae2
Create Date: 2025-06-05 09:38:55.414193

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '373571dfe134'
down_revision = '0fcf1e150ae2'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('submission_images', sa.Column('file_url', sa.String(length=256), nullable=False))
    op.add_column('submission_images', sa.Column('uploaded_at', sa.DateTime(), nullable=True))
    op.drop_column('submission_images', 'is_visible')
    op.drop_column('submission_images', 'file_path')
    op.add_column('submissions', sa.Column('submitted_at', sa.DateTime(), nullable=True))
    op.add_column('submissions', sa.Column('plant_name', sa.String(length=100), nullable=False))
    op.add_column('submissions', sa.Column('approved', sa.Boolean(), nullable=True))
    op.add_column('submissions', sa.Column('approved_at', sa.DateTime(), nullable=True))
    op.add_column('submissions', sa.Column('reviewed_by', sa.Integer(), nullable=True))
    op.drop_constraint(op.f('submissions_ibfk_1'), 'submissions', type_='foreignkey')
    op.create_foreign_key(None, 'submissions', 'users', ['reviewed_by'], ['id'])
    op.drop_column('submissions', 'common_name')
    op.drop_column('submissions', 'height')
    op.drop_column('submissions', 'container_size')
    op.drop_column('submissions', 'timestamp')
    op.drop_column('submissions', 'price')
    op.drop_column('submissions', 'plant_id')
    op.drop_column('submissions', 'width')
    op.drop_column('submissions', 'health_status')
    op.drop_column('submissions', 'leaf_count')
    op.drop_column('submissions', 'potting_mix')
    op.drop_column('submissions', 'source')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('submissions', sa.Column('source', mysql.VARCHAR(length=120), nullable=True))
    op.add_column('submissions', sa.Column('potting_mix', mysql.VARCHAR(length=255), nullable=True))
    op.add_column('submissions', sa.Column('leaf_count', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('submissions', sa.Column('health_status', mysql.VARCHAR(length=50), nullable=True))
    op.add_column('submissions', sa.Column('width', mysql.FLOAT(), nullable=True))
    op.add_column('submissions', sa.Column('plant_id', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('submissions', sa.Column('price', mysql.FLOAT(), nullable=False))
    op.add_column('submissions', sa.Column('timestamp', mysql.DATETIME(), nullable=True))
    op.add_column('submissions', sa.Column('container_size', mysql.VARCHAR(length=120), nullable=True))
    op.add_column('submissions', sa.Column('height', mysql.FLOAT(), nullable=True))
    op.add_column('submissions', sa.Column('common_name', mysql.VARCHAR(length=120), nullable=False))
    op.drop_constraint(None, 'submissions', type_='foreignkey')
    op.create_foreign_key(op.f('submissions_ibfk_1'), 'submissions', 'plant', ['plant_id'], ['id'])
    op.drop_column('submissions', 'reviewed_by')
    op.drop_column('submissions', 'approved_at')
    op.drop_column('submissions', 'approved')
    op.drop_column('submissions', 'plant_name')
    op.drop_column('submissions', 'submitted_at')
    op.add_column('submission_images', sa.Column('file_path', mysql.VARCHAR(length=255), nullable=False))
    op.add_column('submission_images', sa.Column('is_visible', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.drop_column('submission_images', 'uploaded_at')
    op.drop_column('submission_images', 'file_url')
    # ### end Alembic commands ###
