persist relevant receiver_beacon data

pull/34/merge
Konstantin Gründger 2016-01-21 23:18:02 +01:00
rodzic 85a8a1c143
commit 539630ea91
2 zmienionych plików z 47 dodań i 10 usunięć

Wyświetl plik

@ -0,0 +1,37 @@
"""Full receiver beacon info
Revision ID: 269ec1bcf99
Revises: 2c7144443d8
Create Date: 2016-01-19 22:22:50.275615
"""
# revision identifiers, used by Alembic.
revision = '269ec1bcf99'
down_revision = '2c7144443d8'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('receiver_beacon', sa.Column('cpu_load', sa.Float))
op.add_column('receiver_beacon', sa.Column('cpu_temp', sa.Float))
op.add_column('receiver_beacon', sa.Column('free_ram', sa.Float))
op.add_column('receiver_beacon', sa.Column('total_ram', sa.Float))
op.add_column('receiver_beacon', sa.Column('ntp_error', sa.Float))
op.add_column('receiver_beacon', sa.Column('rt_crystal_correction', sa.Float))
op.add_column('receiver_beacon', sa.Column('rec_input_noise', sa.Float))
def downgrade():
op.drop_column('receiver_beacon', 'cpu_load')
op.drop_column('receiver_beacon', 'cpu_temp')
op.drop_column('receiver_beacon', 'free_ram')
op.drop_column('receiver_beacon', 'total_ram')
op.drop_column('receiver_beacon', 'ntp_error')
op.drop_column('receiver_beacon', 'rt_crystal_correction')
op.drop_column('receiver_beacon', 'rec_input_noise')

Wyświetl plik

@ -1,6 +1,6 @@
import re import re
from sqlalchemy import Column, String from sqlalchemy import Column, Float, String
from .beacon import Beacon from .beacon import Beacon
from ogn.exceptions import OgnParseError from ogn.exceptions import OgnParseError
@ -12,16 +12,16 @@ class ReceiverBeacon(Beacon):
# ReceiverBeacon specific data # ReceiverBeacon specific data
version = Column(String) version = Column(String)
platform = Column(String) platform = Column(String)
cpu_load = 0 cpu_load = Column(Float)
cpu_temp = 0 cpu_temp = Column(Float)
free_ram = 0 free_ram = Column(Float)
total_ram = 0 total_ram = Column(Float)
ntp_error = 0 ntp_error = Column(Float)
rt_crystal_correction = 0 rt_crystal_correction = Column(Float)
rec_crystal_correction = 0 rec_crystal_correction = 0 # obsolete since 0.2.0
rec_crystal_correction_fine = 0 rec_crystal_correction_fine = 0 # obsolete since 0.2.0
rec_input_noise = 0 rec_input_noise = Column(Float)
# Pattern # Pattern
version_pattern = re.compile(r"v(\d+\.\d+\.\d+)\.?(.+)?") version_pattern = re.compile(r"v(\d+\.\d+\.\d+)\.?(.+)?")