13 lines
422 B
Python
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()
|