forked from JosXa/TacoBot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dbmodels.py
40 lines (24 loc) · 1.28 KB
/
dbmodels.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from peewee import *
db = SqliteDatabase('taco_base.db') # opening/creating DB
class Chats(Model): # chats-model is here for future updates only
cid = IntegerField()
invited_by = IntegerField()
class Meta:
database = db
if not Chats.table_exists(): # creating chats if not present
db.create_tables([Chats])
class Tacos(Model): # taco-model stores balances and chat-related things
chat = IntegerField()
taco_balance = TextField(null=True,
default='{}')
class Meta:
database = db
if not Tacos.table_exists(): # creating tacos if not present
db.create_tables([Tacos])
class Usernames(Model): # username-model is here only for /tacotop
uid = IntegerField()
name = TextField()
class Meta:
database = db
if not Usernames.table_exists(): # creating usernames if not present
db.create_tables([Usernames])