Skip to content
Snippets Groups Projects
Commit 4c6a9bc8 authored by Davor's avatar Davor
Browse files

add check if the app exists in DB before creating it

parent c88d7ebc
No related branches found
No related tags found
No related merge requests found
......@@ -57,8 +57,14 @@ def create_app(slug, name):
obj.name = name
obj.slug = slug
db.session.add(obj)
db.session.commit()
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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment