Skip to content

Commit

Permalink
Change loading order of database tables
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvsnetworking committed Jan 12, 2024
1 parent 6c41b0b commit 612655e
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions lib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class SUBSCRIBER(Base):
last_modified = Column(String(100), default=datetime.datetime.now(tz=timezone.utc), doc='Timestamp of last modification')
operation_logs = relationship("SUBSCRIBER_OPERATION_LOG", back_populates="subscriber")


class SUBSCRIBER_ROUTING(Base):
__tablename__ = 'subscriber_routing'
__table_args__ = (
Expand All @@ -114,7 +113,6 @@ class SUBSCRIBER_ROUTING(Base):
last_modified = Column(String(100), default=datetime.datetime.now(tz=timezone.utc), doc='Timestamp of last modification')
operation_logs = relationship("SUBSCRIBER_ROUTING_OPERATION_LOG", back_populates="subscriber_routing")


class SERVING_APN(Base):
__tablename__ = 'serving_apn'
serving_apn_id = Column(Integer, primary_key=True, doc='Unique ID of SERVING_APN')
Expand Down Expand Up @@ -158,15 +156,6 @@ class IMS_SUBSCRIBER(Base):
last_modified = Column(String(100), default=datetime.datetime.now(tz=timezone.utc), doc='Timestamp of last modification')
operation_logs = relationship("IMS_SUBSCRIBER_OPERATION_LOG", back_populates="ims_subscriber")

class ROAMING_RULE(Base):
__tablename__ = 'roaming_rule'
roaming_rule_id = Column(Integer, primary_key = True, doc='Unique ID of ROAMING_RULE entry')
roaming_network_id = Column(Integer, ForeignKey('roaming_network.roaming_network_id', ondelete='CASCADE'), doc='ID of the roaming network to apply the rule for')
allow = Column(Boolean, default=1, doc='Whether to allow outbound roaming on the network')
enabled = Column(Boolean, default=1, doc='Whether the rule is enabled')
last_modified = Column(String(100), default=datetime.datetime.now(tz=timezone.utc), doc='Timestamp of last modification')
operation_logs = relationship("ROAMING_RULE_OPERATION_LOG", back_populates="roaming_rule")

class ROAMING_NETWORK(Base):
__tablename__ = 'roaming_network'
roaming_network_id = Column(Integer, primary_key = True, doc='Unique ID of ROAMING_NETWORK entry')
Expand All @@ -177,6 +166,15 @@ class ROAMING_NETWORK(Base):
last_modified = Column(String(100), default=datetime.datetime.now(tz=timezone.utc), doc='Timestamp of last modification')
operation_logs = relationship("ROAMING_NETWORK_OPERATION_LOG", back_populates="roaming_network")

class ROAMING_RULE(Base):
__tablename__ = 'roaming_rule'
roaming_rule_id = Column(Integer, primary_key = True, doc='Unique ID of ROAMING_RULE entry')
roaming_network_id = Column(Integer, ForeignKey('roaming_network.roaming_network_id', ondelete='CASCADE'), doc='ID of the roaming network to apply the rule for')
allow = Column(Boolean, default=1, doc='Whether to allow outbound roaming on the network')
enabled = Column(Boolean, default=1, doc='Whether the rule is enabled')
last_modified = Column(String(100), default=datetime.datetime.now(tz=timezone.utc), doc='Timestamp of last modification')
operation_logs = relationship("ROAMING_RULE_OPERATION_LOG", back_populates="roaming_rule")

class CHARGING_RULE(Base):
__tablename__ = 'charging_rule'
charging_rule_id = Column(Integer, primary_key = True, doc='Unique ID of CHARGING_RULE entry')
Expand Down Expand Up @@ -261,6 +259,11 @@ class SERVING_APN_OPERATION_LOG(OPERATION_LOG_BASE):
serving_apn = relationship("SERVING_APN", back_populates="operation_logs")
serving_apn_id = Column(Integer, ForeignKey('serving_apn.serving_apn_id'))

class EMERGENCY_SESSION_OPERATION_LOG(OPERATION_LOG_BASE):
__mapper_args__ = {'polymorphic_identity': 'emergency_session'}
serving_apn = relationship("EMERGENCY_SESSION", back_populates="operation_logs")
emergency_session_id = Column(Integer, ForeignKey('emergency_session.emergency_session_id'))

class AUC_OPERATION_LOG(OPERATION_LOG_BASE):
__mapper_args__ = {'polymorphic_identity': 'auc'}
auc = relationship("AUC", back_populates="operation_logs")
Expand Down

0 comments on commit 612655e

Please sign in to comment.