a2cfbc6c2673_add_river_cross_section.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. """add_river_cross_section
  2. Revision ID: a2cfbc6c2673
  3. Revises: e484105cc893
  4. Create Date: 2025-07-12 01:35:26.959660
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = 'a2cfbc6c2673'
  10. down_revision = 'e484105cc893'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. """升级数据库到当前版本"""
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. op.create_table('cross_section',
  17. sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='主键ID'),
  18. sa.Column('river_name', sa.String(length=50), nullable=False, comment='所属河流'),
  19. sa.Column('position', sa.String(length=100), nullable=False, comment='断面位置'),
  20. sa.Column('county', sa.String(length=50), nullable=False, comment='所属行政区'),
  21. sa.Column('longitude', sa.Float(), nullable=False, comment='经度坐标(精确到小数点后六位数)'),
  22. sa.Column('latitude', sa.Float(), nullable=False, comment='纬度坐标(精确到小数点后六位数)'),
  23. sa.Column('cd_concentration', sa.Float(), nullable=False, comment='镉浓度(mg/L)'),
  24. sa.PrimaryKeyConstraint('id')
  25. )
  26. # ### end Alembic commands ###
  27. def downgrade():
  28. """将数据库降级到上一版本"""
  29. # ### commands auto generated by Alembic - please adjust! ###
  30. op.drop_table('cross_section')
  31. # ### end Alembic commands ###