from cgi import test import this from sqlalchemy import Column,Integer,String,Boolean,ForeignKey,Sequence,ForeignKeyConstraint import persistence __db_Base = persistence.get_db_base() class inventory_site(__db_Base): __tablename__ = "tInventory_sites" id = Column(Integer,Sequence('inventory_site_id_seq'), primary_key=True, nullable=False) name = Column(String(150)) address = Column(String) gps_coordinates = Column(String) note = Column(String) tags = Column(String) contact_id = Column(Integer, ForeignKey('tInventory_contacts.id')) class inventory_item(__db_Base): __tablename__ = "tInventory_items" id = Column(Integer,Sequence('inventory_item_id_seq'), primary_key=True, nullable=False) name = Column(String(100), nullable=False) note = Column(String) brand = Column(String(50)) wear_score = Column(Integer) type = Column(String(50)) owned = Column(Boolean, default= True) tags = Column(String) custom_fields_json = Column(String) assigned = Column(Boolean, default= False) assign_date_epoch = Column(Integer) serial_number = Column(String) group_id = Column(Integer, ForeignKey('tInventory_groups.id',onupdate="cascade",ondelete="cascade"), nullable=True) contact_id = Column(Integer, ForeignKey('tInventory_contacts.id',onupdate="cascade",ondelete="cascade"), nullable=True) site_id = Column(Integer, ForeignKey('tInventory_sites.id',onupdate="cascade",ondelete="cascade"), nullable=True) class inventory_group(__db_Base): __tablename__ = "tInventory_groups" id = Column(Integer,Sequence('inventory_group_id_seq'), primary_key=True, nullable=False) name = Column(String(100), nullable=False) note = Column(String) class inventory_contact(__db_Base): __tablename__ = "tInventory_contacts" id = Column(Integer,Sequence('inventory_contact_id_seq'), primary_key=True, nullable=False) contact_person = Column(String(150)) contact_mail = Column(String(100)) contact_number = Column(String(100)) note = Column(String) tags = Column(String)