Skip to content

Commit

Permalink
IGCFile: Add weglide_status and weglide_data fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jan 16, 2021
1 parent d959912 commit 8af88d9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
17 changes: 17 additions & 0 deletions migrations/versions/58325345d375_add_weglide_fields_to_igcfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# revision identifiers, used by Alembic.
revision = "58325345d375"
down_revision = "70a6f5e6f0e1"

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSONB


def upgrade():
op.add_column("igc_files", sa.Column("weglide_data", JSONB(), nullable=True))
op.add_column("igc_files", sa.Column("weglide_status", sa.Integer(), nullable=True))


def downgrade():
op.drop_column("igc_files", "weglide_status")
op.drop_column("igc_files", "weglide_data")
10 changes: 10 additions & 0 deletions skylines/model/igcfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from sqlalchemy.sql.expression import and_
from sqlalchemy.types import Integer, DateTime, String, Unicode, Date
from sqlalchemy.dialects.postgresql import JSONB

from skylines.database import db
from skylines.lib import files
Expand Down Expand Up @@ -33,6 +34,15 @@ class IGCFile(db.Model):

date_utc = db.Column(Date, nullable=False)

# WeGlide API response HTTP status code,
# or None (no upload requested)
# or 1 (upload in progress),
# or 2 (generic error),
weglide_status = db.Column(Integer)

# WeGlide API response JSON payload, or `null`
weglide_data = db.Column(JSONB)

def __repr__(self):
return unicode_to_str(
"<IGCFile: id=%d filename='%s'>" % (self.id, self.filename)
Expand Down

0 comments on commit 8af88d9

Please sign in to comment.