3f2e574cefad_add_parameter_table.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. """add_parameter_table
  2. Revision ID: 3f2e574cefad
  3. Revises: 92ec1d480a3c
  4. Create Date: 2025-07-11 15:29:01.868419
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = '3f2e574cefad'
  10. down_revision = '92ec1d480a3c'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. """升级数据库到当前版本"""
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. op.create_table('Parameters',
  17. sa.Column('ID', sa.Integer(), autoincrement=True, nullable=False),
  18. sa.Column('F1', sa.Float(), nullable=True, comment='活性SOM的占比系数'),
  19. sa.Column('F2', sa.Float(), nullable=True, comment='HA占比系数'),
  20. sa.Column('F3', sa.Float(), nullable=True, comment='氮肥镉含量平均值(mg/kg)'),
  21. sa.Column('F4', sa.Float(), nullable=True, comment='磷肥镉含量平均值(mg/kg)'),
  22. sa.Column('F5', sa.Float(), nullable=True, comment='钾肥镉含量平均值(mg/kg)'),
  23. sa.Column('F6', sa.Float(), nullable=True, comment='复合肥镉含量平均值(mg/kg)'),
  24. sa.Column('F7', sa.Float(), nullable=True, comment='有机肥镉含量平均值(mg/kg)'),
  25. sa.Column('F8', sa.Float(), nullable=True, comment='农药镉含量(mg/kg)'),
  26. sa.Column('F9', sa.Float(), nullable=True, comment='农家肥镉含量(mg/kg)'),
  27. sa.Column('F10', sa.Float(), nullable=True, comment='农膜镉含量(mg/kg)'),
  28. sa.Column('F11', sa.Float(), nullable=True, comment='作物亩产量(斤)'),
  29. sa.Column('NF', sa.Float(), nullable=True, comment='氮肥单位面积使用量(t/ha/a)'),
  30. sa.Column('PF', sa.Float(), nullable=True, comment='磷肥单位面积使用量(t/ha/a)'),
  31. sa.Column('KF', sa.Float(), nullable=True, comment='钾肥单位面积使用量(t/ha/a)'),
  32. sa.Column('CF', sa.Float(), nullable=True, comment='复合肥单位面积使用量(t/ha/a)'),
  33. sa.Column('OF', sa.Float(), nullable=True, comment='有机肥单位面积使用量(t/ha/a)'),
  34. sa.Column('P', sa.Float(), nullable=True, comment='农药单位面积使用量(t/ha/a)'),
  35. sa.Column('FF', sa.Float(), nullable=True, comment='农家肥单位面积使用量(t/ha/a)'),
  36. sa.Column('AF', sa.Float(), nullable=True, comment='农膜(存留)单位面积使用量(t/ha/a)'),
  37. sa.Column('Area', sa.String(length=50), nullable=True, comment='地区'),
  38. sa.PrimaryKeyConstraint('ID')
  39. )
  40. # ### end Alembic commands ###
  41. def downgrade():
  42. """将数据库降级到上一版本"""
  43. # ### commands auto generated by Alembic - please adjust! ###
  44. op.drop_table('Parameters')
  45. # ### end Alembic commands ###