"""init2

Revision ID: c1cf3ab2c7fe
Revises: 
Create Date: 2025-05-11 09:13:03.260708

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

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


def upgrade():
    """升级数据库到当前版本"""
    # ### commands auto generated by Alembic - please adjust! ###
    # 将磷酸二氢铵字段改为lin_suan_er_qing_an
    op.alter_column('fifty_thousand_survey_data', 
                   column_name='磷酸二氢铵', 
                   new_column_name='lin_suan_er_qing_an',
                   existing_type=sa.Float(precision=53),
                   nullable=True)
    # 创建raster_table表的rast字段索引
    op.alter_column('surveydata', 
                   column_name='磷酸二氢铵', 
                   new_column_name='lin_suan_er_qing_an',
                   existing_type=sa.Float(precision=53),
                   nullable=True)
    # ### end Alembic commands ###


def downgrade():
    """将数据库降级到上一版本"""
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('surveydata', 
                   column_name='lin_suan_er_qing_an', 
                   new_column_name='磷酸二氢铵',
                   existing_type=sa.Float(precision=53),
                   nullable=True)
    op.alter_column('fifty_thousand_survey_data', 
                   column_name='lin_suan_er_qing_an', 
                   new_column_name='磷酸二氢铵',
                   existing_type=sa.Float(precision=53),
                   nullable=True)
    # ### end Alembic commands ###
