ogn-python/app/model/country_stats.py

18 wiersze
532 B
Python
Czysty Zwykły widok Historia

2019-08-31 08:14:41 +00:00
from app import db
2019-03-06 20:11:46 +00:00
class CountryStats(db.Model):
__tablename__ = "country_stats"
id = db.Column(db.Integer, primary_key=True)
date = db.Column(db.Date)
# Static data
aircraft_beacon_count = db.Column(db.Integer)
device_count = db.Column(db.Integer)
# Relations
2019-08-31 08:14:41 +00:00
country_id = db.Column(db.Integer, db.ForeignKey("countries.gid", ondelete="SET NULL"), index=True)
country = db.relationship("Country", foreign_keys=[country_id], backref=db.backref("stats", order_by="CountryStats.date.asc()"))