<s> import datetime <EOL> from sqlalchemy import Column , Integer , Boolean , String , ForeignKey , DateTime , UniqueConstraint <EOL> from sqlalchemy . orm import relationship , backref <EOL> from sqlalchemy . dialects . postgresql . base import UUID <EOL> from sqlalchemy . ext . declarative import declarative_base <EOL> Base = declarative_base ( ) <EOL> class User ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> username = Column ( String , nullable = False , unique = True ) <EOL> email = Column ( String , nullable = False ) <EOL> password = Column ( String , nullable = False ) <EOL> created_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> update_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> sessions = relationship ( "<STR_LIT>" , cascade = "<STR_LIT:all>" , backref = "<STR_LIT:user>" ) <EOL> user_role_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , ondelete = "<STR_LIT>" ) , nullable = True ) <EOL> user_role = relationship ( "<STR_LIT>" , backref = "<STR_LIT>" ) <EOL> class UserRole ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String , nullable = False , unique = True ) <EOL> class HttpRequest ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> created_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> http_protocol = Column ( String , nullable = False ) <EOL> method = Column ( String , nullable = False ) <EOL> url = Column ( String , nullable = False ) <EOL> response_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = True ) <EOL> response = relationship ( "<STR_LIT>" , uselist = False , backref = "<STR_LIT>" ) <EOL> class HttpRequestHeaders ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> request = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) ) <EOL> header = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) ) <EOL> class HttpResponse ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> created_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> http_protocol = Column ( String , nullable = False ) <EOL> status_code = Column ( Integer , nullable = False ) <EOL> status_description = Column ( String , nullable = False ) <EOL> class HttpResponseHeaders ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> response = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) ) <EOL> header = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) ) <EOL> class HttpHeader ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> key = Column ( String , nullable = False ) <EOL> value = Column ( String ) <EOL> class Session ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String , nullable = False ) <EOL> description = Column ( String , default = '<STR_LIT>' ) <EOL> testplan = relationship ( "<STR_LIT>" , uselist = False , backref = "<STR_LIT>" ) <EOL> testplan_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = True ) <EOL> user_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> created_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> updated_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> session_executions = relationship ( "<STR_LIT>" , backref = "<STR_LIT>" ) <EOL> class SessionExecution ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> created_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> started_at = Column ( DateTime ) <EOL> stopped_at = Column ( DateTime ) <EOL> session_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> session_traffic = relationship ( "<STR_LIT>" , backref = "<STR_LIT>" ) <EOL> matches = relationship ( "<STR_LIT>" , backref = "<STR_LIT>" ) <EOL> class SessionTraffic ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> session_execution_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , <EOL> nullable = False ) <EOL> http_request_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , nullable = False ) <EOL> class TestPlan ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String , nullable = False ) <EOL> description = Column ( String , default = '<STR_LIT>' ) <EOL> created_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> updated_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> latency_enabled = Column ( Boolean , default = False ) <EOL> client_latency = Column ( Integer ) <EOL> server_latency = Column ( Integer ) <EOL> rules = relationship ( "<STR_LIT>" , backref = "<STR_LIT>" ) <EOL> class Rule ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> created_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> updated_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> rule_type = Column ( String , nullable = False ) <EOL> filter = relationship ( "<STR_LIT>" , uselist = False , backref = "<STR_LIT>" , cascade = "<STR_LIT:all>" ) <EOL> action = relationship ( "<STR_LIT>" , uselist = False , backref = "<STR_LIT>" , cascade = "<STR_LIT:all>" ) <EOL> testplan_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> class Filter ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> method = Column ( String ) <EOL> status_code = Column ( String ) <EOL> url = Column ( String ) <EOL> protocol = Column ( String ) <EOL> rule_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> headers = relationship ( "<STR_LIT>" , backref = "<STR_LIT>" , cascade = "<STR_LIT>" ) <EOL> class FilterHeaders ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> filter_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) ) <EOL> key = Column ( String ) <EOL> value = Column ( String ) <EOL> class Action ( Base ) : <EOL> __tablename__ = "<STR_LIT:action>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> type = Column ( String , nullable = False ) <EOL> rule_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> class ActionResponse ( Action ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , primary_key = True ) <EOL> http_protocol = Column ( String ) <EOL> status_code = Column ( Integer ) <EOL> status_description = Column ( String ) <EOL> payload = Column ( String ) <EOL> class ActionRequest ( Action ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , primary_key = True ) <EOL> http_protocol = Column ( String ) <EOL> method = Column ( String ) <EOL> url = Column ( String ) <EOL> payload = Column ( String ) <EOL> class ActionHeaders ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> action = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> header = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> class Match ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> session_execution_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , <EOL> nullable = False ) <EOL> rule_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> http_request = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> class Recording ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String , nullable = False ) <EOL> description = Column ( String , default = '<STR_LIT>' ) <EOL> user = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> created_at = Column ( DateTime , default = datetime . datetime . utcnow ) <EOL> session_traffic = relationship ( "<STR_LIT>" , backref = "<STR_LIT>" ) <EOL> class RecordingTraffic ( Base ) : <EOL> __tablename__ = "<STR_LIT>" <EOL> id = Column ( Integer , primary_key = True ) <EOL> recording_id = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) <EOL> http_request = Column ( Integer , ForeignKey ( '<STR_LIT>' , onupdate = "<STR_LIT>" , ondelete = "<STR_LIT>" ) , nullable = False ) </s>
