Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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])
Ejemplo n.º 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")
Ejemplo n.º 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")