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.name = name
|
||||||
obj.slug = slug
|
obj.slug = slug
|
||||||
|
|
||||||
db.session.add(obj)
|
app = db.session.query(App).filter_by(slug=slug).first()
|
||||||
db.session.commit()
|
|
||||||
|
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")
|
@app_cli.command("list")
|
||||||
|
|
Loading…
Reference in a new issue