39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""add airports to track
|
|
|
|
Revision ID: 956d295689bf
|
|
Revises: 8b0c020dc0c4
|
|
Create Date: 2023-09-28 22:43:52.286599
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '956d295689bf'
|
|
down_revision = '8b0c020dc0c4'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('flight_track', sa.Column('airport_id', sa.Integer(), nullable=True))
|
|
op.add_column('flight_track', sa.Column('landing_duration', sa.Integer(), nullable=True))
|
|
op.alter_column('flight_track', 'point_of_interest_id',
|
|
existing_type=mysql.INTEGER(display_width=11),
|
|
nullable=True)
|
|
op.create_foreign_key(None, 'flight_track', 'airport', ['airport_id'], ['id'])
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_constraint(None, 'flight_track', type_='foreignkey')
|
|
op.alter_column('flight_track', 'point_of_interest_id',
|
|
existing_type=mysql.INTEGER(display_width=11),
|
|
nullable=False)
|
|
op.drop_column('flight_track', 'landing_duration')
|
|
op.drop_column('flight_track', 'airport_id')
|
|
# ### end Alembic commands ###
|