43 lines
1.9 KiB
Python
43 lines
1.9 KiB
Python
"""rename columns with weather
|
|
|
|
Revision ID: 5c43394aa8e0
|
|
Revises: 434066bcb25d
|
|
Create Date: 2023-08-16 16:31:36.204608
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '5c43394aa8e0'
|
|
down_revision = '434066bcb25d'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('flight', sa.Column('takeoff_weather_info_id', sa.Integer(), nullable=True))
|
|
op.add_column('flight', sa.Column('landing_weather_info_id', sa.Integer(), nullable=True))
|
|
op.drop_constraint('flight_ibfk_6', 'flight', type_='foreignkey')
|
|
op.drop_constraint('flight_ibfk_7', 'flight', type_='foreignkey')
|
|
op.create_foreign_key(None, 'flight', 'weather_info', ['takeoff_weather_info_id'], ['id'])
|
|
op.create_foreign_key(None, 'flight', 'weather_info', ['landing_weather_info_id'], ['id'])
|
|
op.drop_column('flight', 'weather_info_landing_id')
|
|
op.drop_column('flight', 'weather_info_takeoff_id')
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('flight', sa.Column('weather_info_takeoff_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
|
|
op.add_column('flight', sa.Column('weather_info_landing_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
|
|
op.drop_constraint(None, 'flight', type_='foreignkey')
|
|
op.drop_constraint(None, 'flight', type_='foreignkey')
|
|
op.create_foreign_key('flight_ibfk_7', 'flight', 'weather_info', ['weather_info_takeoff_id'], ['id'])
|
|
op.create_foreign_key('flight_ibfk_6', 'flight', 'weather_info', ['weather_info_landing_id'], ['id'])
|
|
op.drop_column('flight', 'landing_weather_info_id')
|
|
op.drop_column('flight', 'takeoff_weather_info_id')
|
|
# ### end Alembic commands ###
|