45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
"""Add airspace_item table
|
|
|
|
Revision ID: aba4c3876b28
|
|
Revises: 7dd139549851
|
|
Create Date: 2024-03-18 10:05:57.516697
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'aba4c3876b28'
|
|
down_revision = '7dd139549851'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('airspace_item',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('country', sa.String(length=8), nullable=False),
|
|
sa.Column('name', sa.String(length=128), nullable=False),
|
|
sa.Column('type', sa.String(length=8), nullable=False),
|
|
sa.Column('lower_limit', sa.String(length=32), nullable=False),
|
|
sa.Column('upper_limit', sa.String(length=32), nullable=False),
|
|
sa.Column('center', mysql.JSON(), nullable=False),
|
|
sa.Column('radius', sa.Float(), nullable=True),
|
|
sa.Column('bounds', mysql.JSON(), nullable=False),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('name')
|
|
)
|
|
op.create_index(op.f('ix_airspace_item_country'), 'airspace_item', ['country'], unique=False)
|
|
op.create_index(op.f('ix_airspace_item_type'), 'airspace_item', ['type'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_airspace_item_type'), table_name='airspace_item')
|
|
op.drop_index(op.f('ix_airspace_item_country'), table_name='airspace_item')
|
|
op.drop_table('airspace_item')
|
|
# ### end Alembic commands ###
|