3c8a8862c800_add_atmo_company_table.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. """add_atmo_company_table
  2. Revision ID: 3c8a8862c800
  3. Revises: 981f62cc2cdb
  4. Create Date: 2025-07-12 01:28:26.221250
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = '3c8a8862c800'
  10. down_revision = '981f62cc2cdb'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. """升级数据库到当前版本"""
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. op.create_table('atmo_company',
  17. sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='污染源序号'),
  18. sa.Column('longitude', sa.Float(), nullable=True, comment='经度坐标(精确到小数点后六位)'),
  19. sa.Column('latitude', sa.Float(), nullable=True, comment='纬度坐标(精确到小数点后六位)'),
  20. sa.Column('company_name', sa.String(length=100), nullable=True, comment='企业名称'),
  21. sa.Column('company_type', sa.String(length=50), nullable=True, comment='企业类型'),
  22. sa.Column('county', sa.String(length=50), nullable=True, comment='所属区县'),
  23. sa.Column('particulate_emission', sa.Float(), nullable=True, comment='大气颗粒物排放量(吨/年)'),
  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('atmo_company')
  31. # ### end Alembic commands ###