class Flight(db.Model):
    __tablename__ = 'Flight'
    id = db.Column(db.String(20), primary_key=True)

    start_time = db.Column(db.Time, nullable=False)
    arrive_time = db.Column(db.Time, nullable=False)
    first_class_price = db.Column(db.FLOAT, nullable=False)
    business_class_price = db.Column(db.FLOAT, nullable=False)
    economy_class_price = db.Column(db.FLOAT, nullable=False)

    num_remain_seat = db.Column(db.Integer)
    num_remain_first_class = db.Column(db.Integer)
    num_remain_business_class = db.Column(db.Integer)
    num_remain_economy_class = db.Column(db.Integer)

    air_line_id = db.Column(db.Integer, db.ForeignKey('AirLine.id'))
    airport_id = db.Column(db.Integer, db.ForeignKey("Airport.id"))
    plane_id = db.Column(db.String(20), db.ForeignKey('Plane.id'))
    air_company_name = db.Column(db.String(80),
                                 db.ForeignKey('AirCompany.name'))

    db.CheckConstraint('num_remain_seat > 0', name='check4')
    db.CheckConstraint('num_remain_first_class > 0', name='check5')
    db.CheckConstraint('num_remain_business_class > 0', name='check6')
    db.CheckConstraint('num_remain_economy_class > 0', name='check7')
class MaintenanceInformation(db.Model):
    __tablename__ = 'maintenance_information'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    hid = db.Column(db.Integer, db.ForeignKey('house_information.id'))
    apply_date = db.Column(db.Date)
    fix_date = db.Column(db.Date, nullable=True)
    fix_number = db.Column(db.String(32), nullable=True)
    pay_amount = db.Column(db.Float, nullable=True)
    comment = db.Column(db.String(128))
    from_balance = db.Column(db.Integer, default=0)
    db.CheckConstraint('fix_date >= apply_date', name='check_date')
    db.CheckConstraint('pay_amount > 0', name='check_pay')
Esempio n. 3
0
class HouseInformation(db.Model):
    __tablename__ = 'house_information'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    building_number = db.Column(db.String(5))
    room_number = db.Column(db.String(5))
    area = db.Column(db.Float)
    family_size = db.Column(db.Integer)
    maintenance_balance = db.Column(db.Float)
    db.UniqueConstraint(building_number,
                        room_number,
                        name='check_position_unique')
    db.CheckConstraint('area > 0', name='check_area_positive')
    db.CheckConstraint('family_size >= 0', name='check_family_size_positive')
    db.CheckConstraint('maintenance_balance >= 0',
                       name='check_maintenance_balance_positive')
Esempio n. 4
0
class PropertyFeeInformation(db.Model):
    __tablename__ = "property_fee_information"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    hid = db.Column(db.Integer,
                    db.ForeignKey('house_information.id'),
                    nullable=False)
    date = db.Column(db.Date, nullable=False)
    pay_date = db.Column(db.Date, nullable=True)
    pay_amount = db.Column(db.Float, nullable=False)
    ispay = db.Column(db.Integer, nullable=False)
    handle_rid = db.Column(db.Integer,
                           db.ForeignKey('resident_information.id'),
                           nullable=True)
    order_number = db.Column(db.String(32), nullable=True)
    db.CheckConstraint('pay_date >= date', name='check_pay_date')
    db.CheckConstraint('pay_amount > 0', name='check_pay_amount_positive')
Esempio n. 5
0
class Plane(db.Model):
    __tablename__ = 'Plane'
    id = db.Column(db.String(20), primary_key=True)  # 飞机型号

    num_seat = db.Column(db.Integer, nullable=False)
    num_first_class_seat = db.Column(db.Integer, nullable=False)
    num_business_class_seat = db.Column(db.Integer, nullable=False)
    num_economy_class_seat = db.Column(db.Integer, nullable=False)

    db.CheckConstraint('num_first_class + num_tourist_class == num_seat',
                       name='check1')
Esempio n. 6
0
class AirLine(db.Model):
    __tablename__ = 'AirLine'
    id = db.Column(db.Integer,
                   primary_key=True,
                   nullable=False,
                   autoincrement=True)

    start = db.Column(db.String(80), nullable=False)
    destination = db.Column(db.String(80), nullable=False)
    airline_date = db.Column(db.Date, nullable=False)
    mileage = db.Column(db.FLOAT)
    db.CheckConstraint('mileage > 0', name='check3')
Esempio n. 7
0
class WI(JsonifyModel):
    __tablename__ = 'wi'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    wid = db.Column(db.Integer,
                    db.ForeignKey('warehouse.id', ondelete="CASCADE"),
                    nullable=False)
    iid = db.Column(db.Integer,
                    db.ForeignKey('inventory.id', ondelete="CASCADE"),
                    nullable=False)
    number = db.Column(db.Integer,
                       db.CheckConstraint('number > 0'),
                       nullable=False)
    wi_unique = db.UniqueConstraint(wid, iid)
Esempio n. 8
0
class ParkingSpotPayInformation(db.Model):
    __tablename__ = "parking_spot_pay_information"
    id = db.Column(db.Integer, autoincrement=True, primary_key=True)
    pid = db.Column(db.Integer,
                    db.ForeignKey('parking_spot_information.id'),
                    nullable=False)
    date = db.Column(db.Date, nullable=False)
    pay_date = db.Column(db.Date, nullable=True)
    pay_amount = db.Column(db.Float, nullable=False)
    handle_rid = db.Column(db.Integer,
                           db.ForeignKey('resident_information.id'),
                           nullable=True)
    ispay = db.Column(db.Integer, nullable=False)
    db.CheckConstraint('pay_date >= date', name='check_pay_date')