Exemplo n.º 1
0
class Review(BaseModel):
    """
        description: Review description
    """

    __tablename__ = "Reviews"
    reader_id = db.Column(db.String,
                          db.ForeignKey("People.id", ondelete="CASCADE"),
                          primary_key=True)
    book_id = db.Column(db.String, db.ForeignKey("Books.id"), primary_key=True)
    review = db.Column(db.String, default="")
    created = db.Column(db.DateTime)
Exemplo n.º 2
0
class Book(BaseModel):
    """
        description: Book description
    """

    __tablename__ = "Books"
    id = db.Column(db.String, primary_key=True)
    title = db.Column(db.String, default="")
    reader_id = db.Column(db.String, db.ForeignKey("People.id"))
    author_id = db.Column(db.String, db.ForeignKey("People.id"))
    publisher_id = db.Column(db.Integer, db.ForeignKey("Publishers.id"))
    publisher = db.relationship("Publisher", back_populates="books")
    reviews = db.relationship(
        "Review",
        backref="book",
        cascade="save-update, merge, delete, delete-orphan")
Exemplo n.º 3
0
class SubThing(BaseModel):
    __tablename__ = "subthing"
    _s_auto_commit = True
    id = db.Column(db.String, primary_key=True, server_default=func.uuid_generate_v1())
    name = db.Column(db.String, nullable=False)

    thing_id = db.Column(db.String, db.ForeignKey("thing.id"))
    thing = db.relationship("Thing", foreign_keys=thing_id)
Exemplo n.º 4
0
class Book2(SAFRSBase, db.Model):
    """
        description: Book description
    """

    __tablename__ = "Books2"
    id = db.Column(db.String, primary_key=True)
    name = db.Column(db.String, default="")
    user_id = db.Column(db.String, db.ForeignKey("Users2.id"))
    user = db.relationship("User", back_populates="books")
Exemplo n.º 5
0
class UnexpBook(db.Model):
    """
        description: Book description
    """

    __tablename__ = "UnexpBooks"
    #id = db.Column(db.Integer, primary_key=True, auto_increment=True)
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String, default="")
    publisher_id = db.Column(db.Integer, db.ForeignKey("Publishers.id"))
    publisher = db.relationship("Publisher", back_populates="unexposed_books")