示例#1
0
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")
示例#2
0
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")
示例#3
0
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])
示例#4
0
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")
示例#5
0
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")