Add aircraft_type

pull/52/head
Konstantin Gründger 2016-05-31 20:56:09 +02:00
rodzic 31a1282afc
commit afd46eeb32
4 zmienionych plików z 32 dodań i 2 usunięć

Wyświetl plik

@ -0,0 +1,28 @@
"""add aircraft_type to device
Revision ID: 258a3f6bbdc
Revises: 7585491482
Create Date: 2016-05-25 20:16:57.990249
"""
# revision identifiers, used by Alembic.
revision = '258a3f6bbdc'
down_revision = '7585491482'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('device', sa.Column('aircraft_type', sa.Integer))
op.create_index('ix_device_aircraft_type', 'device', ['aircraft_type'])
op.create_index('ix_aircraft_beacon_aircraft_type', 'aircraft_beacon', ['aircraft_type'])
def downgrade():
op.drop_index('ix_aircraft_beacon_aircraft_type', 'aircraft_beacon')
op.drop_index('ix_device_aircraft_type', 'device')
op.drop_column('device', 'aircraft_type')

Wyświetl plik

@ -9,7 +9,7 @@ class AircraftBeacon(Beacon):
# Flarm specific data
address_type = Column(SmallInteger)
aircraft_type = Column(SmallInteger)
aircraft_type = Column(SmallInteger, index=True)
stealth = Column(Boolean)
address = Column(String(6))
climb_rate = Column(Float)

Wyświetl plik

@ -18,6 +18,7 @@ class Device(Base):
frequency = Column(String)
tracked = Column(Boolean)
identified = Column(Boolean)
aircraft_type = Column(SmallInteger, index=True)
address_origin = Column(SmallInteger)

Wyświetl plik

@ -10,7 +10,7 @@ from geopy.exc import GeopyError
from aerofiles.seeyou import Reader
from ogn.parser.utils import feet2m
DDB_URL = "http://ddb.glidernet.org/download"
DDB_URL = "http://ddb.glidernet.org/download/?t=1"
address_prefixes = {'F': 'FLR',
@ -41,6 +41,7 @@ def get_ddb(csvfile=None):
device.competition = row[4]
device.tracked = row[5] == 'Y'
device.identified = row[6] == 'Y'
device.aircraft_type = row[7]
devices.append(device)