1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-24 14:54:18 +00:00
This commit is contained in:
Steffo 2018-05-02 16:32:16 +02:00
parent cca22443ee
commit 7ce44fc076
2 changed files with 2 additions and 6 deletions

View file

@ -292,8 +292,4 @@ class OrderItem(TableDeclarativeBase):
return f"<OrderItem {self.item_id}>" return f"<OrderItem {self.item_id}>"
# 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() TableDeclarativeBase.metadata.create_all()
print("Done!")

View file

@ -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 the user isn't registered, create a new record and add it to the db
if self.user is None: 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 # 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 # Create the new record
self.user = db.User(self.chat) self.user = db.User(self.chat)
# Add the new record to the db # Add the new record to the db