db seed command
This commit is contained in:
@@ -6,5 +6,7 @@ class TargetExchange(SurrogatePK, Model):
|
||||
__tablename__ = "target-exchange"
|
||||
name = Column(db.String(255), unique=True, nullable=False)
|
||||
|
||||
def __init__(self, name, **kwargs) -> None:
|
||||
Model.__init__(self, name=name, **kwargs)
|
||||
@staticmethod
|
||||
def ensure_created(name):
|
||||
if TargetExchange.query.filter_by(name=name).first() is None:
|
||||
TargetExchange(name=name).save()
|
||||
|
||||
Reference in New Issue
Block a user