diff --git a/migrations/versions/1fef7b82e48b_wipe_schema_and_ferc1_name_transition.py b/migrations/versions/1fef7b82e48b_wipe_schema_and_ferc1_name_transition.py index 80e88b2943..d43a703aa4 100644 --- a/migrations/versions/1fef7b82e48b_wipe_schema_and_ferc1_name_transition.py +++ b/migrations/versions/1fef7b82e48b_wipe_schema_and_ferc1_name_transition.py @@ -21309,7 +21309,7 @@ def upgrade() -> None: comment="Total annual heat content of fuel consumed by a plant part record in the plant parts list.", ), sa.Column( - "unit_heat_rate_mmbtu_per_mwh_eia", + "heat_rate_mmbtu_mwh_eia", sa.Float(), nullable=True, comment="Fuel content per unit of electricity generated. Coming from MCOE calculation.", @@ -21802,7 +21802,7 @@ def upgrade() -> None: comment="Simplified fuel type code used in PUDL", ), sa.Column( - "unit_heat_rate_mmbtu_per_mwh_ferc1", + "heat_rate_mmbtu_mwh_ferc1", sa.Float(), nullable=True, comment="Fuel content per unit of electricity generated. Calculated from FERC reported fuel consumption and net generation.", diff --git a/migrations/versions/c22d59125ab4_rename_heat_rate_mmbtu_mwh_unit_heat_.py b/migrations/versions/9ccfb2eb8d23_add_unit__to_heat_rate_mmbtu_per_mwh.py similarity index 93% rename from migrations/versions/c22d59125ab4_rename_heat_rate_mmbtu_mwh_unit_heat_.py rename to migrations/versions/9ccfb2eb8d23_add_unit__to_heat_rate_mmbtu_per_mwh.py index f66e808f39..710a4eb2e0 100644 --- a/migrations/versions/c22d59125ab4_rename_heat_rate_mmbtu_mwh_unit_heat_.py +++ b/migrations/versions/9ccfb2eb8d23_add_unit__to_heat_rate_mmbtu_per_mwh.py @@ -1,15 +1,15 @@ -"""Rename heat_rate_mmbtu_mwh -> unit_heat_rate_mmbtu_per_mwh +"""Add unit_ to heat_rate_mmbtu_per_mwh -Revision ID: c22d59125ab4 +Revision ID: 9ccfb2eb8d23 Revises: 1fef7b82e48b -Create Date: 2023-11-08 11:48:55.310396 +Create Date: 2023-11-15 10:27:27.709921 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. -revision = 'c22d59125ab4' +revision = '9ccfb2eb8d23' down_revision = '1fef7b82e48b' branch_labels = None depends_on = None @@ -118,6 +118,12 @@ def upgrade() -> None: batch_op.add_column(sa.Column('unit_heat_rate_mmbtu_per_mwh', sa.Float(), nullable=True, comment='Fuel content per unit of electricity generated. Coming from MCOE calculation.')) batch_op.drop_column('heat_rate_mmbtu_mwh') + with op.batch_alter_table('out_pudl__yearly_assn_eia_ferc1_plant_parts', schema=None) as batch_op: + batch_op.add_column(sa.Column('unit_heat_rate_mmbtu_per_mwh_eia', sa.Float(), nullable=True, comment='Fuel content per unit of electricity generated. Coming from MCOE calculation.')) + batch_op.add_column(sa.Column('unit_heat_rate_mmbtu_per_mwh_ferc1', sa.Float(), nullable=True, comment='Fuel content per unit of electricity generated. Calculated from FERC reported fuel consumption and net generation.')) + batch_op.drop_column('heat_rate_mmbtu_mwh_eia') + batch_op.drop_column('heat_rate_mmbtu_mwh_ferc1') + with op.batch_alter_table('plant_parts_eia', schema=None) as batch_op: batch_op.add_column(sa.Column('unit_heat_rate_mmbtu_per_mwh', sa.Float(), nullable=True, comment='Fuel content per unit of electricity generated. Coming from MCOE calculation.')) batch_op.drop_column('heat_rate_mmbtu_mwh') @@ -131,6 +137,12 @@ def downgrade() -> None: batch_op.add_column(sa.Column('heat_rate_mmbtu_mwh', sa.FLOAT(), nullable=True)) batch_op.drop_column('unit_heat_rate_mmbtu_per_mwh') + with op.batch_alter_table('out_pudl__yearly_assn_eia_ferc1_plant_parts', schema=None) as batch_op: + batch_op.add_column(sa.Column('heat_rate_mmbtu_mwh_ferc1', sa.FLOAT(), nullable=True)) + batch_op.add_column(sa.Column('heat_rate_mmbtu_mwh_eia', sa.FLOAT(), nullable=True)) + batch_op.drop_column('unit_heat_rate_mmbtu_per_mwh_ferc1') + batch_op.drop_column('unit_heat_rate_mmbtu_per_mwh_eia') + with op.batch_alter_table('out_eia__yearly_plant_parts', schema=None) as batch_op: batch_op.add_column(sa.Column('heat_rate_mmbtu_mwh', sa.FLOAT(), nullable=True)) batch_op.drop_column('unit_heat_rate_mmbtu_per_mwh') diff --git a/migrations/versions/f5a33d973154_add_unit__to_ferc1_and_eia_heat_rate_.py b/migrations/versions/f5a33d973154_add_unit__to_ferc1_and_eia_heat_rate_.py deleted file mode 100644 index e6a5b0a89c..0000000000 --- a/migrations/versions/f5a33d973154_add_unit__to_ferc1_and_eia_heat_rate_.py +++ /dev/null @@ -1,37 +0,0 @@ -"""Add unit_ to ferc1 and eia heat rate columns - -Revision ID: f5a33d973154 -Revises: c22d59125ab4 -Create Date: 2023-11-08 12:34:10.536814 - -""" -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = 'f5a33d973154' -down_revision = 'c22d59125ab4' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('out_pudl__yearly_assn_eia_ferc1_plant_parts', schema=None) as batch_op: - batch_op.add_column(sa.Column('unit_heat_rate_mmbtu_per_mwh_eia', sa.Float(), nullable=True, comment='Fuel content per unit of electricity generated. Coming from MCOE calculation.')) - batch_op.add_column(sa.Column('unit_heat_rate_mmbtu_per_mwh_ferc1', sa.Float(), nullable=True, comment='Fuel content per unit of electricity generated. Calculated from FERC reported fuel consumption and net generation.')) - batch_op.drop_column('heat_rate_mmbtu_mwh_ferc1') - batch_op.drop_column('heat_rate_mmbtu_mwh_eia') - - # ### end Alembic commands ### - - -def downgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('out_pudl__yearly_assn_eia_ferc1_plant_parts', schema=None) as batch_op: - batch_op.add_column(sa.Column('heat_rate_mmbtu_mwh_eia', sa.FLOAT(), nullable=True)) - batch_op.add_column(sa.Column('heat_rate_mmbtu_mwh_ferc1', sa.FLOAT(), nullable=True)) - batch_op.drop_column('unit_heat_rate_mmbtu_per_mwh_ferc1') - batch_op.drop_column('unit_heat_rate_mmbtu_per_mwh_eia') - - # ### end Alembic commands ###