from db_setup import db from datetime import datetime class Glacier(db.Model): uid = db.Column(db.Integer, primary_key=True) country = db.Column(db.String(30)) name = db.Column(db.String(30)) def __init__(self, uid, country, name): self.uid = uid self.country = country self.name = name class Annual_Data(db.Model): glacier = db.relationship("Glacier", backref=db.backref("posts", lazy=True)) uid = db.Column(db.Integer, db.ForeignKey("glacier.uid"), nullable=False) surface = db.Column(db.Integer) volume = db.Column(db.Integer) thickness = db.Column(db.Integer) year = db.Column(db.Integer) def __init__(self, surface, volume, thickness, year): self.surface = surface self.volume = volume self.thickness = thickness self.year = year class Annual_Change(db.Model): glacier = db.relationship("Glacier", backref=db.backref("posts", lazy=True)) uid = db.Column(db.Integer, db.ForeignKey("glacier.uid"), nullable=False) surface_change = db.Column(db.Integer) volume_change = db.Column(db.Integer) thickness_change = db.Column(db.Integer) year = db.Column(db.Integer) def __init__(self, surface_change, volume_change, thickness_change, year): self.surface_change = surface_change self.volume_change = volume_change self.thickness_change = thickness_change self.year = year class Users(db.Model): uid = db.Column(db.Integer, primary_key=True) registration_date = db.Column(db.DateTime, nullable=False) def __init__(self, uid): self.uid = uid self.registration_date = datetime.today()