From 53912b12d76437bc8b85089dd299e983ce9cd837 Mon Sep 17 00:00:00 2001 From: HLFH Date: Thu, 17 Nov 2022 10:31:42 +0000 Subject: [PATCH] keep workaround for JSON upload for now --- automua/database.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automua/database.py b/automua/database.py index 08c2c9b..479753c 100644 --- a/automua/database.py +++ b/automua/database.py @@ -120,11 +120,11 @@ def populate_with_example_data(): def populate_with_dict(config: dict) -> None: name: str = config['provider'] short_name = name.split(' ')[0] - pid = db.session.scalar(select(func.count()).select_from(Provider)) + pid = db.session.scalar(select(func.count()).select_from(Provider)) + 1 provider = Provider(id=pid, name=name, short_name=short_name) db.session.add(provider) domains = [] - did = db.session.scalar(select(func.count()).select_from(Domain)) + did = db.session.scalar(select(func.count()).select_from(Domain)) + 1 for domain in config['domains']: domains.append(Domain(id=did, name=domain, provider=provider)) did += 1 @@ -133,7 +133,7 @@ def populate_with_dict(config: dict) -> None: return db.session.add_all(domains) servers = [] - sid = db.session.scalar(select(func.count()).select_from(Server)) + sid = db.session.scalar(select(func.count()).select_from(Server)) + 1 for server in config['servers']: name = server['name'] type_ = server['type']