Files
api/alembic/versions/20230801-043717_add_weather_info_36ea098fde31.py
T

39 lines
1.4 KiB
Python

"""add weather info
Revision ID: 36ea098fde31
Revises: cf1fb904e9ab
Create Date: 2023-08-01 04:37:17.188376
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '36ea098fde31'
down_revision = 'cf1fb904e9ab'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('airport', sa.Column('created_by_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'airport', 'user', ['created_by_id'], ['id'])
op.add_column('flight', sa.Column('weather_info_takeoff_id', sa.Integer(), nullable=True))
op.add_column('flight', sa.Column('weather_info_landing_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'flight', 'weather_info', ['weather_info_takeoff_id'], ['id'])
op.create_foreign_key(None, 'flight', 'weather_info', ['weather_info_landing_id'], ['id'])
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('flight_ibfk_6', 'flight', type_='foreignkey')
op.drop_constraint('flight_ibfk_7', 'flight', type_='foreignkey')
op.drop_column('flight', 'weather_info_landing_id')
op.drop_column('flight', 'weather_info_takeoff_id')
op.drop_constraint('airport_ibfk_1', 'airport', type_='foreignkey')
op.drop_column('airport', 'created_by_id')
# ### end Alembic commands ###