From 7ce44fc076b7a108cc7b7be3850f278ecc997263 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 2 May 2018 16:32:16 +0200 Subject: [PATCH] tiny fix --- database.py | 6 +----- worker.py | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/database.py b/database.py index 524025c..7b09e4a 100644 --- a/database.py +++ b/database.py @@ -292,8 +292,4 @@ class OrderItem(TableDeclarativeBase): return f"" -# If this script is ran as main, try to create all the tables in the database -if __name__ == "__main__": - print("Creating tables...") - TableDeclarativeBase.metadata.create_all() - print("Done!") +TableDeclarativeBase.metadata.create_all() diff --git a/worker.py b/worker.py index 3dcad97..f1715c3 100644 --- a/worker.py +++ b/worker.py @@ -66,7 +66,7 @@ class ChatWorker(threading.Thread): # If the user isn't registered, create a new record and add it to the db if self.user is None: # Check if there are other registered users: if there aren't any, the first user will be owner of the bot - will_be_owner = (self.session.query(db.User).first() is None) + will_be_owner = (self.session.query(db.Admin).first() is None) # Create the new record self.user = db.User(self.chat) # Add the new record to the db