123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- """add_FluxCd_input_table
- Revision ID: 94e2af36dc7b
- Revises: 6fabcd91710d
- Create Date: 2025-07-12 01:08:58.604130
- """
- from alembic import op
- import sqlalchemy as sa
- # revision identifiers, used by Alembic.
- revision = '94e2af36dc7b'
- down_revision = '6fabcd91710d'
- branch_labels = None
- depends_on = None
- def upgrade():
- """升级数据库到当前版本"""
- # ### commands auto generated by Alembic - please adjust! ###
- op.create_table('FluxCd_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('Initial_Cd', sa.Float(), nullable=False, comment='土壤初始Cd总量[g/ha](100m×100m栅格)'),
- sa.Column('DQCJ_Cd', sa.Float(), nullable=False, comment='大气沉降输入镉[g/ha/a]'),
- sa.Column('GGS_Cd', sa.Float(), nullable=False, comment='灌溉水输入镉[g/ha/a]'),
- sa.Column('NCP_Cd', sa.Float(), nullable=False, comment='农业投入品输入镉[g/ha/a]'),
- sa.Column('DX_Cd', sa.Float(), nullable=True, comment='地下渗漏输出镉[g/ha/a]'),
- sa.Column('DB_Cd', sa.Float(), nullable=True, comment='地表径流输出镉[g/ha/a]'),
- sa.Column('ZL_Cd', sa.Float(), nullable=False, comment='籽粒移除输出镉[g/ha/a]'),
- sa.Column('JG_Cd', sa.Float(), nullable=False, comment='秸秆移除输出镉[g/ha/a]'),
- 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('FluxCd_input_data')
- # ### end Alembic commands ###
|