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