class Murder(db.Model): __tablename__ = "murder" id = db.Column(db.Integer, primary_key=True) humanid = db.Column(db.Integer, db.ForeignKey("human.id"), nullable=False) alienid = db.Column(db.Integer, db.ForeignKey("alien.id"), nullable=False) date = db.Column(db.Date, nullable=False, default=date.today) human = db.relation("Human", backref="murder") alien = db.relation("Alien", backref="murder")
class Redemption(db.Model): __tablename__ = "redemption" id = db.Column(db.Integer, primary_key=True) humanid = db.Column(db.Integer, db.ForeignKey("human.id"), nullable=False) shipid = db.Column(db.Integer, db.ForeignKey("spaceship.id"), nullable=False) date = db.Column(db.Date, nullable=False, default=date.today) human = db.relation("Human", backref="redemption") ship = db.relation("Spaceship", backref="redemption")
class Transportation(db.Model): __tablename__ = "transportation" id = db.Column(db.Integer, primary_key=True) humanid = db.Column(db.Integer, db.ForeignKey("human.id"), nullable=False) alienid = db.Column(db.Integer, db.ForeignKey("alien.id"), nullable=False) fromshipid = db.Column(db.Integer, db.ForeignKey("spaceship.id"), nullable=False) toshipid = db.Column(db.Integer, db.ForeignKey("spaceship.id"), nullable=False) date = db.Column(db.Date, nullable=False, default=date.today) human = db.relation("Human", backref="transportation") alien = db.relation("Alien", backref="transportation") fromShip = db.relation("Spaceship", foreign_keys=[fromshipid]) #TODO: verify backrefs toShip = db.relation("Spaceship", foreign_keys=[toshipid])
class Experiment(db.Model): __tablename__ = "experiment" id = db.Column(db.Integer, primary_key=True) humanid = db.Column(db.Integer, db.ForeignKey("human.id"), nullable=False) shipid = db.Column(db.Integer, db.ForeignKey("spaceship.id"), nullable=False) date = db.Column(db.Date, nullable=False, default=date.today) #relationships aliens = db.relation("Alien", secondary=Experiment_alien, backref="experiments")
class Excursion(db.Model): __tablename__ = "excursion" id = db.Column(db.Integer, primary_key=True) alienid = db.Column(db.Integer, db.ForeignKey("alien.id"), nullable=False) shipid = db.Column(db.Integer, db.ForeignKey("spaceship.id"), nullable=False) date = db.Column(db.Date, nullable=False, default=date.today) #relationships humans = db.relation("Human", secondary=Excursion_human, backref="excursions")