"""add_CropCd_input_table Revision ID: 669ebfbec09b Revises: 95832ecc0bdc Create Date: 2025-07-12 01:03:04.780668 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '669ebfbec09b' down_revision = '95832ecc0bdc' branch_labels = None depends_on = None def upgrade(): """升级数据库到当前版本""" # ### commands auto generated by Alembic - please adjust! ### op.create_table('CropCd_input_data', sa.Column('ID', sa.Integer(), autoincrement=True, nullable=False, comment='自增主键'), sa.Column('Farmland_ID', sa.Integer(), nullable=False, comment='关联农地ID'), sa.Column('Sample_ID', sa.Integer(), nullable=False, comment='关联样点ID'), sa.Column('002_0002IDW', sa.Float(), nullable=True, comment='粉粒组分(0.002~0.02mm)质量占比[%]'), sa.Column('02_002IDW', sa.Float(), nullable=True, comment='砂粒组分(0.02~0.2mm)质量占比[%]'), sa.Column('2_02IDW', sa.Float(), nullable=True, comment='石砾组分(>2mm)质量占比[%]'), sa.Column('AvaP', sa.Float(), nullable=True, comment='速效钾(mg/kg)(对应Soil_data.AvaK_IDW)'), sa.Column('AvaK_IDW', sa.Float(), nullable=True, comment='有效磷(mg/kg)(对应Soil_data.AvaP_IDW)'), sa.Column('SAvaK_IDW', sa.Float(), nullable=True, comment='缓效钾(mg/kg)'), sa.Column('TAl_IDW', sa.Float(), nullable=True, comment='全铝含量(%)'), sa.Column('TCa_IDW', sa.Float(), nullable=True, comment='全钙含量(%)'), sa.Column('TFe_IDW', sa.Float(), nullable=True, comment='全铁含量(%)'), sa.Column('TMg_IDW', sa.Float(), nullable=True, comment='全镁含量(%)'), sa.Column('TMn_IDW', sa.Float(), nullable=True, comment='全锰含量(mg/kg)'), sa.Column('TN_IDW', sa.Float(), nullable=True, comment='全氮含量(g/kg)'), sa.Column('TS_IDW', sa.Float(), nullable=True, comment='全硫含量(g/kg)'), sa.Column('solution', sa.Float(), nullable=True, comment='LN(POR_Layer/bd020_90 * 112000*Cd.solution)'), sa.ForeignKeyConstraint(['Farmland_ID', 'Sample_ID'], ['Farmland_data.Farmland_ID', 'Farmland_data.Sample_ID'], ), sa.PrimaryKeyConstraint('ID'), comment='作物镉预测模型输入数据' ) # ### end Alembic commands ### def downgrade(): """将数据库降级到上一版本""" # ### commands auto generated by Alembic - please adjust! ### op.drop_table('CropCd_input_data') # ### end Alembic commands ###