16 lines
483 B
Python
16 lines
483 B
Python
from api.database import (Model, SurrogatePK, db,
|
|
Column)
|
|
|
|
|
|
class TargetExchange(SurrogatePK, Model):
|
|
__tablename__ = "target-exchange"
|
|
name = Column(db.String(255), unique=True, nullable=False)
|
|
|
|
def __init__(self, **kwargs):
|
|
super(TargetExchange, self).__init__(**kwargs)
|
|
|
|
@staticmethod
|
|
def ensure_created(name):
|
|
if TargetExchange.query.filter_by(name=name).first() is None:
|
|
TargetExchange(name=name).save()
|