Overflights implementation
This commit is contained in:
@@ -173,12 +173,43 @@ def upgrade() -> None:
|
||||
# Create indexes for circuits
|
||||
op.create_index('idx_circuit_local_flight_id', 'circuits', ['local_flight_id'])
|
||||
op.create_index('idx_circuit_timestamp', 'circuits', ['circuit_timestamp'])
|
||||
|
||||
# Create overflights table for tracking aircraft talking to the tower but not departing/landing
|
||||
op.create_table('overflights',
|
||||
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
||||
sa.Column('registration', sa.String(length=16), nullable=False),
|
||||
sa.Column('pob', sa.Integer(), nullable=True),
|
||||
sa.Column('type', sa.String(length=32), nullable=True),
|
||||
sa.Column('departure_airfield', sa.String(length=64), nullable=True),
|
||||
sa.Column('destination_airfield', sa.String(length=64), nullable=True),
|
||||
sa.Column('status', sa.Enum('ACTIVE', 'INACTIVE', 'CANCELLED', name='overflightstatus'), nullable=False, server_default='ACTIVE'),
|
||||
sa.Column('call_dt', sa.DateTime(), nullable=False),
|
||||
sa.Column('qsy_dt', sa.DateTime(), nullable=True),
|
||||
sa.Column('notes', sa.Text(), nullable=True),
|
||||
sa.Column('created_dt', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.Column('created_by', sa.String(length=16), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_engine='InnoDB',
|
||||
mysql_charset='utf8mb4',
|
||||
mysql_collate='utf8mb4_unicode_ci'
|
||||
)
|
||||
|
||||
# Create indexes for overflights
|
||||
op.create_index('idx_ovf_registration', 'overflights', ['registration'])
|
||||
op.create_index('idx_ovf_departure_airfield', 'overflights', ['departure_airfield'])
|
||||
op.create_index('idx_ovf_destination_airfield', 'overflights', ['destination_airfield'])
|
||||
op.create_index('idx_ovf_status', 'overflights', ['status'])
|
||||
op.create_index('idx_ovf_call_dt', 'overflights', ['call_dt'])
|
||||
op.create_index('idx_ovf_created_dt', 'overflights', ['created_dt'])
|
||||
op.create_index('idx_ovf_created_by', 'overflights', ['created_by'])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""
|
||||
Drop the circuits, arrivals, departures, and local_flights tables.
|
||||
Drop the overflights, circuits, arrivals, departures, and local_flights tables.
|
||||
"""
|
||||
op.drop_table('overflights')
|
||||
op.drop_table('circuits')
|
||||
op.drop_table('arrivals')
|
||||
op.drop_table('departures')
|
||||
|
||||
Reference in New Issue
Block a user