Пример #1
0
class Guest(db.Model):
    guest_id = db.Column(db.Integer, db.Sequence('guest_id'), primary_key=True)

    guest_fname = db.Column(db.String(100), nullable=False)
    guest_lname = db.Column(db.String(100), nullable=False)
    guest_email = db.Column(db.String(100))

    reservations = db.relationship('Reservation', backref='guest')
    credit_cards = db.relationship('CreditCard', backref='guest')
Пример #2
0
class GolfCourse(db.Model):
    golf_course_id = db.Column(db.Integer,
                               db.Sequence('golf_course_id'),
                               primary_key=True)

    golf_course_name = db.Column(db.String(100))
    golf_course_holes = db.Column(db.Integer)

    resort_id = db.Column(db.Integer, db.ForeignKey('resort.resort_id'))
Пример #3
0
class Building(db.Model):
    building_id = db.Column(db.Integer,
                            db.Sequence('building_id'),
                            primary_key=True)

    building_name = db.Column(db.String(100), nullable=False)
    building_address = db.Column(db.String, nullable=False)

    resort_id = db.Column(db.Integer, db.ForeignKey('resort.resort_id'))

    rooms = db.relationship('Room', backref='building')
Пример #4
0
class Resort(db.Model):
    resort_id = db.Column(db.Integer,
                          db.Sequence('resort_id'),
                          primary_key=True)

    resort_name = db.Column(db.String(100), nullable=False)

    buildings = db.relationship('Building', backref='resort')
    skipasses = db.relationship('SkiPass', backref='resort')
    rentals = db.relationship('Rental', backref='resort')
    golf_courses = db.relationship('GolfCourse', backref='resort')
Пример #5
0
class CreditCard(db.Model):
    cc_id = db.Column(db.Integer, db.Sequence('cc_id'), primary_key=True)

    cc_number = db.Column(db.String(16), nullable=False)
    cc_provider = db.Column(Enum('Visa',
                                 'MasterCard',
                                 'AmericanExpress',
                                 name='accepted_cc_providers'),
                            default='Visa')
    cc_address = db.Column(db.String, nullable=False)
    cc_expiration = db.Column(db.Date, default=date.today)

    guest_id = db.Column(db.Integer, db.ForeignKey('guest.guest_id'))

    reservations = db.relationship('Reservation', backref='credit_card')