add check if the app exists in DB before creating it
This commit is contained in:
parent
c88d7ebc08
commit
4c6a9bc8c9
1 changed files with 8 additions and 2 deletions
|
@ -57,8 +57,14 @@ def create_app(slug, name):
|
|||
obj.name = name
|
||||
obj.slug = slug
|
||||
|
||||
app = db.session.query(App).filter_by(slug=slug).first()
|
||||
|
||||
if app is not None:
|
||||
db.session.add(obj)
|
||||
db.session.commit()
|
||||
else:
|
||||
current_app.logger.info(f"App definition: {name} ({slug}) already exists in database")
|
||||
|
||||
|
||||
|
||||
@app_cli.command("list")
|
||||
|
|
Loading…
Reference in a new issue