Files
mahssagebus-api/api/target_exchange/models.py
2021-09-21 18:38:52 +03:00

13 lines
422 B
Python

from api.database import (Model, SurrogatePK, db,
Column, reference_col, relationship)
class TargetExchange(SurrogatePK, Model):
__tablename__ = "target-exchange"
name = Column(db.String(255), unique=True, nullable=False)
@staticmethod
def ensure_created(name):
if TargetExchange.query.filter_by(name=name).first() is None:
TargetExchange(name=name).save()