Guest User

sla-notification-models-py

a guest
Feb 5th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1. from flask_sqlalchemy import SQLAlchemy
  2.  
  3. db = SQLAlchemy()
  4.  
  5. class EscalationSchedule(db.Model):
  6.  
  7.     __tablename__ = 'escalation_schedule'
  8.  
  9.     id = db.Column(db.Integer, primary_key=True)
  10.     name = db.Column(db.String(80), unique=True)
  11.     api_name = db.Column(db.String(80), unique=True, index=True)
  12.  
  13.     def __init__(self, name):
  14.         self.name = name
  15.         self.api_name = self.generate_api_name( name )
  16.  
  17.     def generate_api_name( self, name ):
  18.         return name
  19.  
  20. class EscalationScheduleLevel( db.Model ):
  21.     __tablename__ = 'escalation_schedule_level'
  22.  
  23.     id = db.Column( db.Integer, primary_key=True )
  24.     schedule_id = db.Column( db.Integer, index=True )
  25.     level = db.Column( db.Integer, index=True )
  26.     breach_interval_sec = db.Column( db.Integer )
  27.  
  28. class EscalationTarget( db.Model ):
  29.     __tablename__ = 'escalation_target'
  30.  
  31.     id = db.Column( db.Integer, primary_key=True )
  32.     escalation_schedule_level_id = db.Column( db.Integer, index=True )
  33.     description = db.Column( db.String(150) )
  34.     target = db.Column( db.String(250) )
  35.     message = db.Column( db.Text )
  36.  
  37. class Group( db.Model ):
  38.     __tablename__ = 'group'
  39.  
  40.     id = db.Column(db.Integer, primary_key=True )
  41.     name = db.Column( db.String(80) )
  42.     zd_id = db.Column(db.Integer)
  43.     zd_name = db.Column(db.String(80) )
  44.     escalation_schedule_id = db.Column( db.Integer )
Advertisement
Add Comment
Please, Sign In to add comment