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')
예제 #2
0
class PR(db.Model):
    __tablename__ = 'pr'
    id = db.Column(db.Integer, primary_key=True, unique=True)
    pid = db.Column(db.Integer,
                    db.ForeignKey('parking_spot_information.id'),
                    nullable=False)
    rid = db.Column(db.Integer,
                    db.ForeignKey('resident_information.id'),
                    nullable=False)
    db.UniqueConstraint(pid, rid, name='prid_constrain')
예제 #3
0
class AircompanyAirline(db.Model):
    __tablename__ = 'AircompanyAirline'
    id = db.Column(db.Integer,
                   primary_key=True,
                   nullable=False,
                   autoincrement=True)

    air_company_name = db.Column(db.String(80),
                                 db.ForeignKey('AirCompany.name'))
    air_line_id = db.Column(db.Integer, db.ForeignKey('AirLine.id'))
예제 #4
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)
예제 #5
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')
예제 #6
0
class Ticket(db.Model):
    __tablename__ = 'Ticket'
    id = db.Column(db.Integer,
                   primary_key=True,
                   nullable=False,
                   autoincrement=True)

    ticket_book_date = db.Column(db.Date, nullable=False)
    ticket_pay_price = db.Column(db.FLOAT)
    ticket_class = db.Column(db.String(20), nullable=False)

    flight_id = db.Column(db.String(20), db.ForeignKey('Flight.id'))
    customer_username = db.Column(db.String(32),
                                  db.ForeignKey("Customer.username"))
    seat_id = db.Column(db.Integer, db.ForeignKey("Seat.id"))
예제 #7
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')
class Seat(db.Model):
    __tablename__ = 'Seat'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)

    seat_code = db.Column(db.Integer)
    seat_type = db.Column(db.String(20))

    plane_id = db.Column(db.String(20), db.ForeignKey('Plane.id'))
class Salary(db.Model):
    __tablename__ = 'salary'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    tid = db.Column(db.Integer, db.ForeignKey('teacher.id'))
    check_fine = db.Column(db.Float)
    basic_salary = db.Column(db.Float)
    bonus = db.Column(db.Float)
    tax = db.Column(db.Float)
    date = db.Column(db.Date)
    comment = db.Column(db.String(128))
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')
class Teacher(db.Model):
    __tablename__ = 'teacher'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(10), nullable=False)
    username = db.Column(db.String(10), nullable=False, unique=True)
    password = db.Column(db.String(128), nullable=False)
    age = db.Column(db.Integer)
    gender = db.Column(db.Integer)
    education = db.Column(db.String(20))
    title = db.Column(db.String(10))
    marry = db.Column(db.Integer)
    did = db.Column(db.Integer, db.ForeignKey(Department.id))
    hiredate = db.Column(db.DateTime)
    status = db.Column(db.Integer)
예제 #12
0
class RH(db.Model):
    __tablename__ = 'rh'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    rid = db.Column(db.Integer, db.ForeignKey('resident_information.id'))
    hid = db.Column(db.Integer, db.ForeignKey('house_information.id'))
예제 #13
0
class Check(db.Model):
    __tablename__ = 'check'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    tid = db.Column(db.Integer, db.ForeignKey('teacher.id'))
    date = db.Column(db.Date)
    check = db.Column(db.Integer)