diff --git a/src/covid19/blueprints/ecdc/ecdc_model.py b/src/covid19/blueprints/ecdc/ecdc_model.py index 9f3500a2a465075fd6a62139bd2aba6f0cfb301b..a48c995e107240e28f1f5c277687bd475803230f 100644 --- a/src/covid19/blueprints/ecdc/ecdc_model.py +++ b/src/covid19/blueprints/ecdc/ecdc_model.py @@ -5,10 +5,10 @@ from covid19.blueprints.application.application_model import ApplicationDateRepo class EcdcDateReported(ApplicationDateReported): - __tablename__ = 'ecdc_date_reported' + __tablename__ = 'ecdc_datereported' __mapper_args__ = {'concrete': True} __table_args__ = ( - db.UniqueConstraint('date_reported', 'datum', name="uix_ecdc_date_reported"), + db.UniqueConstraint('date_reported', 'datum', name="uix_ecdc_datereported"), ) id = db.Column(db.Integer, primary_key=True) @@ -198,8 +198,8 @@ class EcdcData(db.Model): order_by='asc(EcdcCountry.countries_and_territories)' ) - ecdc_date_reported_id = db.Column(db.Integer, db.ForeignKey('ecdc_date_reported.id'), nullable=False) - ecdc_date_reported = db.relationship( + ecdc_datereported_id = db.Column(db.Integer, db.ForeignKey('ecdc_datereported.id'), nullable=False) + ecdc_datereported = db.relationship( 'EcdcDateReported', lazy='joined', cascade='all, delete', order_by='desc(EcdcDateReported.date_reported)' @@ -229,30 +229,30 @@ class EcdcData(db.Model): return db.session.query(cls).filter(cls.id == other_id).one_or_none() @classmethod - def find_by_date_reported(cls, ecdc_date_reported, page: int): + def find_by_date_reported(cls, ecdc_datereported, page: int): return db.session.query(cls).filter( - cls.ecdc_date_reported_id == ecdc_date_reported.id)\ + cls.ecdc_datereported_id == ecdc_datereported.id)\ .order_by(cls.cumulative_number_for_14_days_of_covid19_cases_per_100000.desc())\ .paginate(page, per_page=ITEMS_PER_PAGE) @classmethod - def find_by_date_reported_notification_rate(cls, ecdc_date_reported, page: int): + def find_by_date_reported_notification_rate(cls, ecdc_datereported, page: int): return db.session.query(cls).filter( - cls.ecdc_date_reported_id == ecdc_date_reported.id) \ + cls.ecdc_datereported_id == ecdc_datereported.id) \ .order_by(cls.cumulative_number_for_14_days_of_covid19_cases_per_100000.desc()) \ .paginate(page, per_page=ITEMS_PER_PAGE) @classmethod - def find_by_date_reported_deaths_weekly(cls, ecdc_date_reported, page: int): + def find_by_date_reported_deaths_weekly(cls, ecdc_datereported, page: int): return db.session.query(cls).filter( - cls.ecdc_date_reported_id == ecdc_date_reported.id) \ + cls.ecdc_datereported_id == ecdc_datereported.id) \ .order_by(cls.deaths.desc()) \ .paginate(page, per_page=ITEMS_PER_PAGE) @classmethod - def find_by_date_reported_cases_weekly(cls, ecdc_date_reported, page: int): + def find_by_date_reported_cases_weekly(cls, ecdc_datereported, page: int): return db.session.query(cls).filter( - cls.ecdc_date_reported_id == ecdc_date_reported.id) \ + cls.ecdc_datereported_id == ecdc_datereported.id) \ .order_by(cls.cases.desc()) \ .paginate(page, per_page=ITEMS_PER_PAGE) diff --git a/src/covid19/blueprints/owid/owid_model.py b/src/covid19/blueprints/owid/owid_model.py index 2d13ee514b1c9a4caeb8b88197c3942e1d9f13d2..9031cfd788926618f56df61362b5460e02d453a8 100644 --- a/src/covid19/blueprints/owid/owid_model.py +++ b/src/covid19/blueprints/owid/owid_model.py @@ -6,10 +6,10 @@ from covid19.blueprints.application.application_model import ApplicationDateRepo class OwidDateReported(ApplicationDateReported): - __tablename__ = 'owid_date_reported' + __tablename__ = 'owid_datereported' __mapper_args__ = {'concrete': True} __table_args__ = ( - db.UniqueConstraint('date_reported', 'datum', name="uix_owid_date_reported"), + db.UniqueConstraint('date_reported', 'datum', name="uix_owid_datereported"), ) id = db.Column(db.Integer, primary_key=True) @@ -129,7 +129,7 @@ class OwidData(db.Model): id = db.Column(db.Integer, primary_key=True) date_reported_id = db.Column(db.Integer, - db.ForeignKey('owid_date_reported.id'), nullable=False) + db.ForeignKey('owid_datereported.id'), nullable=False) date_reported = db.relationship( 'OwidDateReported', lazy='joined', diff --git a/src/covid19/blueprints/rki/rki_vaccination/rki_vaccination_model.py b/src/covid19/blueprints/rki/rki_vaccination/rki_vaccination_model.py index 342ed12497591d6aa970d59dcd49f8b16e4e2060..64bf7b1803bc673acc71e71cee3ddc07212e9fe9 100644 --- a/src/covid19/blueprints/rki/rki_vaccination/rki_vaccination_model.py +++ b/src/covid19/blueprints/rki/rki_vaccination/rki_vaccination_model.py @@ -5,12 +5,12 @@ from covid19.blueprints.application.application_model import ApplicationDateRepo class RkiVaccinationDateReported(ApplicationDateReported): - __tablename__ = 'rki_vaccination_date_reported' + __tablename__ = 'rki_vaccination_datereported' __mapper_args__ = { 'concrete': True } __table_args__ = ( - db.UniqueConstraint('date_reported', 'datum', name="uix_rki_vaccination_date_reported"), + db.UniqueConstraint('date_reported', 'datum', name="uix_rki_vaccination_datereported"), ) id = db.Column(db.Integer, primary_key=True) @@ -49,7 +49,7 @@ class RkiVaccinationData(db.Model): __tablename__ = 'rki_vaccination' id = db.Column(db.Integer, primary_key=True) - date_reported_id = db.Column(db.Integer, db.ForeignKey('rki_vaccination_date_reported.id'), nullable=False) + date_reported_id = db.Column(db.Integer, db.ForeignKey('rki_vaccination_datereported.id'), nullable=False) date_reported = db.relationship( 'RkiVaccinationDateReported', lazy='joined', diff --git a/src/covid19/blueprints/who/who_model.py b/src/covid19/blueprints/who/who_model.py index 78e5931ade0064b75d6c361c3a99e7311a6dda6c..85099568d342ba808e83875ee8bc202a5e465e35 100644 --- a/src/covid19/blueprints/who/who_model.py +++ b/src/covid19/blueprints/who/who_model.py @@ -6,10 +6,10 @@ from covid19.blueprints.application.application_model import ApplicationDateRepo class WhoDateReported(ApplicationDateReported): - __tablename__ = 'who_date_reported' + __tablename__ = 'who_datereported' __mapper_args__ = {'concrete': True} __table_args__ = ( - db.UniqueConstraint('date_reported', 'datum', name="uix_who_date_reported"), + db.UniqueConstraint('date_reported', 'datum', name="uix_who_datereported"), ) id = db.Column(db.Integer, primary_key=True) @@ -159,7 +159,7 @@ class WhoData(db.Model): deaths_new = db.Column(db.Integer, nullable=False) deaths_cumulative = db.Column(db.Integer, nullable=False) date_reported_id = db.Column(db.Integer, - db.ForeignKey('who_date_reported.id'), nullable=False) + db.ForeignKey('who_datereported.id'), nullable=False) date_reported = db.relationship( 'WhoDateReported', lazy='joined',