Skip to content

Instantly share code, notes, and snippets.

@jdangerx
Created August 17, 2023 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdangerx/541db1c90c0ec22084737df583366d9d to your computer and use it in GitHub Desktop.
Save jdangerx/541db1c90c0ec22084737df583366d9d to your computer and use it in GitHub Desktop.
migration comparison
"""fake juice awareness
Revision ID: d1da0341420e
Revises: 28bb2b27e2cf
Create Date: 2023-08-17 12:39:35.950853
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd1da0341420e'
down_revision = '28bb2b27e2cf'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('fake',
sa.Column('report_date', sa.Date(), nullable=False, comment='Date reported.'),
sa.PrimaryKeyConstraint('report_date')
)
with op.batch_alter_table('advanced_metering_infrastructure_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('balancing_authority_assn_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('balancing_authority_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('boiler_fuel_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('capacity_factor_by_generator_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('compiled_geometry_balancing_authority_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('compiled_geometry_utility_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_hourly_pa_ferc714', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_response_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_response_water_heater_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_side_management_ee_dr_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_side_management_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_side_management_sales_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_boiler_fuel_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_boiler_fuel_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_fuel_receipts_costs_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_fuel_receipts_costs_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_generation_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_generation_fuel_combined_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_generation_fuel_combined_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_generation_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('distributed_generation_fuel_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('distributed_generation_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('distributed_generation_tech_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('distribution_systems_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('dynamic_pricing_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('energy_efficiency_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('fipsified_respondents_ferc714', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('fuel_cost_by_generator_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('fuel_receipts_costs_aggs_eia', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('fuel_receipts_costs_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_fuel_by_generator_energy_source_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_fuel_by_generator_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_fuel_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_fuel_nuclear_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('green_pricing_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('heat_rate_by_generator_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('heat_rate_by_unit_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('mcoe_generators_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('mcoe_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('mergers_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('net_metering_customer_fuel_class_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('net_metering_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('non_net_metering_customer_fuel_class_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('non_net_metering_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('operational_data_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('operational_data_revenue_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('reliability_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('sales_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('service_territory_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('summarized_demand_ferc714', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utilities_eia860', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utility_assn_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utility_data_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utility_data_nerc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utility_data_rto_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'fake', ['report_date'], ['report_date'])
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('utility_data_rto_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('utility_data_nerc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('utility_data_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('utility_assn_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('utilities_eia860', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('summarized_demand_ferc714', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('service_territory_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('sales_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('reliability_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('operational_data_revenue_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('operational_data_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('non_net_metering_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('non_net_metering_customer_fuel_class_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('net_metering_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('net_metering_customer_fuel_class_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('mergers_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('mcoe_monthly', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('mcoe_generators_monthly', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('heat_rate_by_unit_monthly', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('heat_rate_by_generator_monthly', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('green_pricing_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('generation_fuel_nuclear_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('generation_fuel_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('generation_fuel_by_generator_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('generation_fuel_by_generator_energy_source_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('generation_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('fuel_receipts_costs_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('fuel_receipts_costs_aggs_eia', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('fuel_cost_by_generator_monthly', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('fipsified_respondents_ferc714', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('energy_efficiency_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('dynamic_pricing_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('distribution_systems_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('distributed_generation_tech_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('distributed_generation_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('distributed_generation_fuel_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('denorm_generation_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('denorm_generation_fuel_combined_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('denorm_generation_fuel_combined_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('denorm_generation_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('denorm_fuel_receipts_costs_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('denorm_fuel_receipts_costs_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('denorm_boiler_fuel_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('denorm_boiler_fuel_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('demand_side_management_sales_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('demand_side_management_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('demand_side_management_ee_dr_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('demand_response_water_heater_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('demand_response_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('demand_hourly_pa_ferc714', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('compiled_geometry_utility_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('compiled_geometry_balancing_authority_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('capacity_factor_by_generator_monthly', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('boiler_fuel_eia923', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('balancing_authority_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('balancing_authority_assn_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('advanced_metering_infrastructure_eia861', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
op.drop_table('fake')
# ### end Alembic commands ###
"""fake juice awareness
Revision ID: 1b8997d87477
Revises: 16948340e558
Create Date: 2023-08-17 12:33:01.964769
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1b8997d87477'
down_revision = '16948340e558'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('fake',
sa.Column('report_date', sa.Date(), nullable=False, comment='Date reported.'),
sa.PrimaryKeyConstraint('report_date', name=op.f('pk_fake'))
)
with op.batch_alter_table('advanced_metering_infrastructure_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_advanced_metering_infrastructure_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('balancing_authority_assn_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_balancing_authority_assn_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('balancing_authority_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_balancing_authority_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('boiler_fuel_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_boiler_fuel_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('capacity_factor_by_generator_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_capacity_factor_by_generator_monthly_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('compiled_geometry_balancing_authority_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_compiled_geometry_balancing_authority_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('compiled_geometry_utility_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_compiled_geometry_utility_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_hourly_pa_ferc714', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_demand_hourly_pa_ferc714_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_response_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_demand_response_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_response_water_heater_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_demand_response_water_heater_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_side_management_ee_dr_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_demand_side_management_ee_dr_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_side_management_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_demand_side_management_misc_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('demand_side_management_sales_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_demand_side_management_sales_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_boiler_fuel_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_denorm_boiler_fuel_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_boiler_fuel_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_denorm_boiler_fuel_monthly_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_fuel_receipts_costs_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_denorm_fuel_receipts_costs_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_fuel_receipts_costs_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_denorm_fuel_receipts_costs_monthly_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_generation_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_denorm_generation_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_generation_fuel_combined_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_denorm_generation_fuel_combined_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_generation_fuel_combined_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_denorm_generation_fuel_combined_monthly_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('denorm_generation_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_denorm_generation_monthly_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('distributed_generation_fuel_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_distributed_generation_fuel_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('distributed_generation_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_distributed_generation_misc_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('distributed_generation_tech_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_distributed_generation_tech_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('distribution_systems_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_distribution_systems_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('dynamic_pricing_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_dynamic_pricing_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('energy_efficiency_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_energy_efficiency_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('fipsified_respondents_ferc714', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_fipsified_respondents_ferc714_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('fuel_cost_by_generator_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_fuel_cost_by_generator_monthly_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('fuel_receipts_costs_aggs_eia', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_fuel_receipts_costs_aggs_eia_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('fuel_receipts_costs_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_fuel_receipts_costs_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_generation_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_fuel_by_generator_energy_source_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_generation_fuel_by_generator_energy_source_monthly_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_fuel_by_generator_monthly_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_generation_fuel_by_generator_monthly_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_fuel_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_generation_fuel_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('generation_fuel_nuclear_eia923', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_generation_fuel_nuclear_eia923_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('green_pricing_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_green_pricing_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('heat_rate_by_generator_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_heat_rate_by_generator_monthly_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('heat_rate_by_unit_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_heat_rate_by_unit_monthly_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('mcoe_generators_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_mcoe_generators_monthly_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('mcoe_monthly', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_mcoe_monthly_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('mergers_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_mergers_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('net_metering_customer_fuel_class_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_net_metering_customer_fuel_class_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('net_metering_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_net_metering_misc_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('non_net_metering_customer_fuel_class_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_non_net_metering_customer_fuel_class_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('non_net_metering_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_non_net_metering_misc_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('operational_data_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_operational_data_misc_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('operational_data_revenue_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_operational_data_revenue_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('reliability_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_reliability_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('sales_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_sales_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('service_territory_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_service_territory_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('summarized_demand_ferc714', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_summarized_demand_ferc714_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utilities_eia860', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_utilities_eia860_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utility_assn_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_utility_assn_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utility_data_misc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_utility_data_misc_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utility_data_nerc_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_utility_data_nerc_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
with op.batch_alter_table('utility_data_rto_eia861', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f('fk_utility_data_rto_eia861_report_date_fake'), 'fake', ['report_date'], ['report_date'])
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('utility_data_rto_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_utility_data_rto_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('utility_data_nerc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_utility_data_nerc_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('utility_data_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_utility_data_misc_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('utility_assn_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_utility_assn_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('utilities_eia860', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_utilities_eia860_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('summarized_demand_ferc714', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_summarized_demand_ferc714_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('service_territory_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_service_territory_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('sales_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_sales_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('reliability_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_reliability_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('operational_data_revenue_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_operational_data_revenue_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('operational_data_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_operational_data_misc_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('non_net_metering_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_non_net_metering_misc_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('non_net_metering_customer_fuel_class_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_non_net_metering_customer_fuel_class_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('net_metering_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_net_metering_misc_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('net_metering_customer_fuel_class_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_net_metering_customer_fuel_class_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('mergers_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_mergers_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('mcoe_monthly', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_mcoe_monthly_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('mcoe_generators_monthly', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_mcoe_generators_monthly_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('heat_rate_by_unit_monthly', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_heat_rate_by_unit_monthly_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('heat_rate_by_generator_monthly', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_heat_rate_by_generator_monthly_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('green_pricing_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_green_pricing_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('generation_fuel_nuclear_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_generation_fuel_nuclear_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('generation_fuel_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_generation_fuel_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('generation_fuel_by_generator_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_generation_fuel_by_generator_monthly_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('generation_fuel_by_generator_energy_source_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_generation_fuel_by_generator_energy_source_monthly_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('generation_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_generation_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('fuel_receipts_costs_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_fuel_receipts_costs_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('fuel_receipts_costs_aggs_eia', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_fuel_receipts_costs_aggs_eia_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('fuel_cost_by_generator_monthly', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_fuel_cost_by_generator_monthly_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('fipsified_respondents_ferc714', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_fipsified_respondents_ferc714_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('energy_efficiency_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_energy_efficiency_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('dynamic_pricing_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_dynamic_pricing_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('distribution_systems_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_distribution_systems_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('distributed_generation_tech_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_distributed_generation_tech_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('distributed_generation_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_distributed_generation_misc_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('distributed_generation_fuel_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_distributed_generation_fuel_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('denorm_generation_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_denorm_generation_monthly_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('denorm_generation_fuel_combined_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_denorm_generation_fuel_combined_monthly_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('denorm_generation_fuel_combined_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_denorm_generation_fuel_combined_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('denorm_generation_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_denorm_generation_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('denorm_fuel_receipts_costs_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_denorm_fuel_receipts_costs_monthly_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('denorm_fuel_receipts_costs_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_denorm_fuel_receipts_costs_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('denorm_boiler_fuel_monthly_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_denorm_boiler_fuel_monthly_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('denorm_boiler_fuel_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_denorm_boiler_fuel_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('demand_side_management_sales_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_demand_side_management_sales_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('demand_side_management_misc_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_demand_side_management_misc_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('demand_side_management_ee_dr_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_demand_side_management_ee_dr_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('demand_response_water_heater_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_demand_response_water_heater_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('demand_response_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_demand_response_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('demand_hourly_pa_ferc714', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_demand_hourly_pa_ferc714_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('compiled_geometry_utility_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_compiled_geometry_utility_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('compiled_geometry_balancing_authority_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_compiled_geometry_balancing_authority_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('capacity_factor_by_generator_monthly', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_capacity_factor_by_generator_monthly_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('boiler_fuel_eia923', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_boiler_fuel_eia923_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('balancing_authority_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_balancing_authority_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('balancing_authority_assn_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_balancing_authority_assn_eia861_report_date_fake'), type_='foreignkey')
with op.batch_alter_table('advanced_metering_infrastructure_eia861', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_advanced_metering_infrastructure_eia861_report_date_fake'), type_='foreignkey')
op.drop_table('fake')
# ### end Alembic commands ###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment