-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
79 lines (58 loc) · 1.75 KB
/
Copy pathdatabase.py
File metadata and controls
79 lines (58 loc) · 1.75 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from peewee import (
Model,
MySQLDatabase,
IntegerField,
CharField,
BooleanField,
DateTimeField,
ForeignKeyField,
SqliteDatabase,
)
import settings
xenforo = MySQLDatabase(
settings.XENFORO_DB_NAME,
user=settings.XENFORO_DB_USER,
password=settings.XENFORO_DB_PASS,
host=settings.XENFORO_DB_HOST,
port=int(settings.XENFORO_DB_PORT),
)
bot = SqliteDatabase(settings.BOT_DB_NAME)
class User(Model):
"""Xenforo user model"""
user_id = IntegerField(primary_key=True)
username = CharField()
class Meta:
database = xenforo
table_name = "xf_user"
class Game(Model):
"""Opserv game model as it currently exists in the opserv_games table"""
game_id = IntegerField(primary_key=True)
tag = CharField()
game_name = CharField()
retired = BooleanField()
class Meta:
database = xenforo
table_name = "opserv_games"
class Operation(Model):
"""Opserv operation model as it currently exists in the opserv_operations table"""
operation_id = IntegerField(primary_key=True)
operation_name = CharField()
is_completed = BooleanField()
type_id = IntegerField()
date_start = DateTimeField()
date_end = DateTimeField()
leader_user_id = ForeignKeyField(User)
game_id = ForeignKeyField(Game)
is_opsec = BooleanField()
class Meta:
database = xenforo
table_name = "opserv_operations"
class Notification30(Model):
"""Notification model for the 30 reminder sent for operations"""
operation_id = IntegerField(primary_key=True)
date_start = DateTimeField()
class Meta:
database = bot
# Make sure the database exists and the schemas are created
bot.connect()
bot.create_tables([Notification30])