c4c4ef058b7d_add_water_sample_table.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. """add_water_sample_table
  2. Revision ID: c4c4ef058b7d
  3. Revises: 3c8a8862c800
  4. Create Date: 2025-07-12 01:32:55.709345
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = 'c4c4ef058b7d'
  10. down_revision = '3c8a8862c800'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. """升级数据库到当前版本"""
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. op.create_table('water_sampling_data',
  17. sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='采样点ID'),
  18. sa.Column('sample_code', sa.String(length=20), nullable=True, comment='样品编码'),
  19. sa.Column('sample_number', sa.String(length=20), nullable=True, comment='样品编号'),
  20. sa.Column('longitude', sa.Float(), nullable=True, comment='经度坐标(精确到小数点后六位数)'),
  21. sa.Column('latitude', sa.Float(), nullable=True, comment='纬度坐标(精确到小数点后六位数)'),
  22. sa.Column('sampling_location', sa.String(length=100), nullable=True, comment='采样位置描述'),
  23. sa.Column('sample_time', sa.DateTime(), nullable=True, comment='采样时间'),
  24. sa.Column('weather', sa.String(length=50), nullable=True, comment='天气状况'),
  25. sa.Column('container_material', sa.String(length=50), nullable=True, comment='储存容器材质'),
  26. sa.Column('container_color', sa.String(length=50), nullable=True, comment='储存容器颜色'),
  27. sa.Column('container_capacity', sa.Integer(), nullable=True, comment='储存容器容量(mL)'),
  28. sa.Column('sampling_volume', sa.Float(), nullable=True, comment='采样体积(mL)'),
  29. sa.Column('sample_description', sa.Text(), nullable=True, comment='样品状态感官描述'),
  30. sa.Column('water_quality', sa.String(length=100), nullable=True, comment='断面水质表现'),
  31. sa.Column('water_environment', sa.String(length=100), nullable=True, comment='断面周边环境'),
  32. sa.Column('storage_method', sa.Text(), nullable=True, comment='保存方式'),
  33. sa.Column('cr_concentration', sa.Float(), nullable=True, comment='铬(Cr)含量(μg/L)'),
  34. sa.Column('as_concentration', sa.Float(), nullable=True, comment='砷(As)含量(μg/L)'),
  35. sa.Column('cd_concentration', sa.Float(), nullable=True, comment='镉(Cd)含量(μg/L)'),
  36. sa.Column('hg_concentration', sa.Float(), nullable=True, comment='汞(Hg)含量(μg/L)'),
  37. sa.Column('pb_concentration', sa.Float(), nullable=True, comment='铅(Pb)含量(μg/L)'),
  38. sa.Column('ph_value', sa.Float(), nullable=True, comment='水样pH值'),
  39. sa.PrimaryKeyConstraint('id')
  40. )
  41. # ### end Alembic commands ###
  42. def downgrade():
  43. """将数据库降级到上一版本"""
  44. # ### commands auto generated by Alembic - please adjust! ###
  45. op.drop_table('water_sampling_data')
  46. # ### end Alembic commands ###